mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
fix test_runas integration test for macosx
This commit is contained in:
parent
d23471262d
commit
c0730ff968
@ -38,6 +38,21 @@ class CMDModuleTest(ModuleCase):
|
||||
'''
|
||||
Validate the cmd module
|
||||
'''
|
||||
def setUp(self):
|
||||
if self._testMethodName == 'test_runas':
|
||||
# only need to manage this user for the test_runas test
|
||||
self.runas_usr = 'nobody'
|
||||
if salt.utils.platform.is_darwin():
|
||||
self.runas_usr = 'macsalttest'
|
||||
if self.runas_usr not in self.run_function('user.info', [self.runas_usr]).values():
|
||||
self.run_function('user.add', [self.runas_usr])
|
||||
|
||||
def tearDown(self):
|
||||
if self._testMethodName == 'test_runas':
|
||||
if salt.utils.platform.is_darwin():
|
||||
if self.runas_usr in self.run_function('user.info', [self.runas_usr]).values():
|
||||
self.run_function('user.delete', [self.runas_usr], remove=True)
|
||||
|
||||
def test_run(self):
|
||||
'''
|
||||
cmd.run
|
||||
@ -266,12 +281,13 @@ class CMDModuleTest(ModuleCase):
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), 'minion is windows')
|
||||
@skip_if_not_root
|
||||
@destructiveTest
|
||||
def test_runas(self):
|
||||
'''
|
||||
Ensure that the env is the runas user's
|
||||
'''
|
||||
out = self.run_function('cmd.run', ['env'], runas='nobody').splitlines()
|
||||
self.assertIn('USER=nobody', out)
|
||||
out = self.run_function('cmd.run', ['env'], runas=self.runas_usr).splitlines()
|
||||
self.assertIn('USER={0}'.format(self.runas_usr), out)
|
||||
|
||||
def test_timeout(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user