mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
test_members cleanup
This commit is contained in:
parent
ba815dbf76
commit
bf27e5d36e
1 changed files with 5 additions and 9 deletions
|
@ -184,10 +184,14 @@ class GroupAddTestCase(TestCase):
|
|||
|
||||
{'grains': {'kernel': 'Linux'},
|
||||
'cmd': 'gpasswd --members foo test'},
|
||||
|
||||
{'grains': {'kernel': 'OpenBSD'},
|
||||
'cmd': 'usermod -G test foo'},
|
||||
]
|
||||
|
||||
for os_version in os_version_list:
|
||||
mock_ret = MagicMock(return_value={'retcode': 0})
|
||||
mock_stdout = MagicMock(return_value={'cmd.run_stdout': 1})
|
||||
mock_info = MagicMock(return_value={'passwd': '*',
|
||||
'gid': 0,
|
||||
'name': 'test',
|
||||
|
@ -197,19 +201,11 @@ class GroupAddTestCase(TestCase):
|
|||
with patch.dict(groupadd.__grains__, os_version['grains']):
|
||||
with patch.dict(groupadd.__salt__, {'cmd.retcode': mock_ret,
|
||||
'group.info': mock_info,
|
||||
'cmd.run_stdout': mock_stdout,
|
||||
'cmd.run': mock}):
|
||||
self.assertFalse(groupadd.members('test', 'foo'))
|
||||
groupadd.__salt__['cmd.retcode'].assert_called_once_with(os_version['cmd'], python_shell=False)
|
||||
|
||||
mock_stdout = MagicMock(return_value={'cmd.run_stdout': 1})
|
||||
mock = MagicMock()
|
||||
with patch.dict(groupadd.__grains__, {'kernel': 'OpenBSD'}):
|
||||
with patch.dict(groupadd.__salt__, {'cmd.retcode': mock_ret,
|
||||
'group.info': mock_info,
|
||||
'cmd.run_stdout': mock_stdout,
|
||||
'cmd.run': mock}):
|
||||
self.assertFalse(groupadd.members('foo', ['root']))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
|
|
Loading…
Add table
Reference in a new issue