mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
set __grains__ for fstab unit test
This commit is contained in:
parent
f0f5d449c3
commit
80e9d1d278
@ -89,18 +89,19 @@ class MountTestCase(TestCase):
|
||||
self.assertEqual(mount.fstab(), {})
|
||||
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
file_data = '\n'.join(['#',
|
||||
'A B C D,E,F G H'])
|
||||
with patch('salt.utils.fopen',
|
||||
mock_open(read_data=file_data),
|
||||
create=True) as m:
|
||||
m.return_value.__iter__.return_value = file_data.splitlines()
|
||||
self.assertEqual(mount.fstab(), {'B': {'device': 'A',
|
||||
'dump': 'G',
|
||||
'fstype': 'C',
|
||||
'opts': ['D', 'E', 'F'],
|
||||
'pass': 'H'}})
|
||||
with patch.dict(mount.__grains__, {'kernel': ''}):
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
file_data = '\n'.join(['#',
|
||||
'A B C D,E,F G H'])
|
||||
with patch('salt.utils.fopen',
|
||||
mock_open(read_data=file_data),
|
||||
create=True) as m:
|
||||
m.return_value.__iter__.return_value = file_data.splitlines()
|
||||
self.assertEqual(mount.fstab(), {'B': {'device': 'A',
|
||||
'dump': 'G',
|
||||
'fstype': 'C',
|
||||
'opts': ['D', 'E', 'F'],
|
||||
'pass': 'H'}})
|
||||
|
||||
def test_rm_fstab(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user