mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixes for testing
This commit is contained in:
parent
77dd7a1743
commit
92818f816b
2 changed files with 5 additions and 9 deletions
|
@ -1646,7 +1646,7 @@ def filesystems(config='/etc/filesystems'):
|
|||
|
||||
ret_dict = _filesystems(config)
|
||||
if ret_dict:
|
||||
ret_key = ret_dict.keys()[0]
|
||||
ret_key = next(iter(ret_dict.keys()))
|
||||
ret = {ret_key: dict(ret_dict[ret_key])}
|
||||
|
||||
return ret
|
||||
|
|
|
@ -272,10 +272,11 @@ class MountTestCase(TestCase, LoaderModuleMockMixin):
|
|||
change the mount to match the data passed, or add the mount
|
||||
if it is not present.
|
||||
'''
|
||||
mock = MagicMock(return_value=True)
|
||||
mock = MagicMock(return_value=False)
|
||||
with patch.dict(mount.__grains__, {'os': 'AIX', 'kernel': 'AIX'}):
|
||||
self.assertRaises(CommandExecutionError,
|
||||
mount.set_filesystems, 'A', 'B', 'C')
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
self.assertRaises(CommandExecutionError,
|
||||
mount.set_filesystems, 'A', 'B', 'C')
|
||||
|
||||
mock_read = MagicMock(side_effect=OSError)
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
|
@ -283,11 +284,6 @@ class MountTestCase(TestCase, LoaderModuleMockMixin):
|
|||
self.assertRaises(CommandExecutionError,
|
||||
mount.set_filesystems, 'A', 'B', 'C')
|
||||
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
with patch('salt.utils.files.fopen',
|
||||
mock_open(read_data=MOCK_SHELL_FILE)):
|
||||
self.assertEqual(mount.set_filesystems('A', 'B', 'C'), 'new')
|
||||
|
||||
def test_mount(self):
|
||||
'''
|
||||
Mount a device
|
||||
|
|
Loading…
Add table
Reference in a new issue