Changes: Fixed security test 5

Details: There were real bugs in the test case (e.g. in sorting).
         Modified the test to use methods from utils.py.
pull/1/head
Oskari Timperi 15 years ago
parent 5259cc2925
commit 665079f4b8

@ -222,44 +222,36 @@ class SecurityTests(unittest.TestCase):
See NB#183566, NB#187583 See NB#183566, NB#187583
""" """
# stop applauncherd
Popen(['initctl', 'stop', 'xsession/applauncherd']).wait()
time.sleep(2)
# remove sockets
try:
for f in glob.glob('/tmp/boost*'):
os.remove(f)
except Exception as e:
print e
def do_it(): def do_it():
""" """
A helper function to launch application and get credentials A helper function to launch application and get credentials
as user and root. as user and root.
""" """
handle = Popen(['su', '-', 'user', '-c', handle = Popen(['/usr/bin/fala_ft_hello'],
'/usr/bin/fala_ft_hello'],
stdout = DEV_NULL, stderr = DEV_NULL) stdout = DEV_NULL, stderr = DEV_NULL)
# give the application some time to launch up # give the application some time to launch up
time.sleep(2) time.sleep(2)
user = get_creds('fala_ft_hello') root = get_creds('fala_ft_hello')
kill_process('fala_ft_hello') kill_process('fala_ft_hello')
root = launch_and_get_creds('/usr/bin/fala_ft_hello').sort() user = launch_and_get_creds('/usr/bin/fala_ft_hello')
user.sort()
root.sort()
return (user, root) return (user, root)
stop_applauncherd()
# get creds for a launched application when applauncherd # get creds for a launched application when applauncherd
# is not running # is not running
creds1 = do_it() creds1 = do_it()
# start applauncherd start_applauncherd()
Popen(['initctl', 'start', 'xsession/applauncherd']).wait()
time.sleep(2)
# get creds for the same application when applauncherd # get creds for the same application when applauncherd
# is running # is running

Loading…
Cancel
Save