mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Fix unit tests
This commit is contained in:
parent
614b768d6a
commit
66afd4855c
@ -76,7 +76,11 @@ class XAttrTestCase(TestCase):
|
||||
'''
|
||||
Test writing a specific attribute to a file
|
||||
'''
|
||||
self.assertTrue(xattr.write('/path/to/file', 'attribute', 'value'))
|
||||
mock_cmd = MagicMock(return_value='squarepants')
|
||||
with patch.object(xattr, 'read', mock_cmd):
|
||||
self.assertTrue(xattr.write('/path/to/file',
|
||||
'spongebob',
|
||||
'squarepants'))
|
||||
|
||||
@patch('salt.utils.mac_utils.execute_return_success',
|
||||
MagicMock(side_effect=CommandExecutionError('No such file')))
|
||||
@ -96,6 +100,8 @@ class XAttrTestCase(TestCase):
|
||||
'''
|
||||
Test deleting a specific attribute from a file
|
||||
'''
|
||||
mock_cmd = MagicMock(return_value={'spongebob': 'squarepants'})
|
||||
with patch.object(xattr, 'list', mock_cmd):
|
||||
self.assertTrue(xattr.delete('/path/to/file', 'attribute'))
|
||||
|
||||
@patch('salt.utils.mac_utils.execute_return_success',
|
||||
@ -115,6 +121,8 @@ class XAttrTestCase(TestCase):
|
||||
'''
|
||||
Test clearing all attributes on a file
|
||||
'''
|
||||
mock_cmd = MagicMock(return_value={})
|
||||
with patch.object(xattr, 'list', mock_cmd):
|
||||
self.assertTrue(xattr.clear('/path/to/file'))
|
||||
|
||||
@patch('salt.utils.mac_utils.execute_return_success',
|
||||
|
Loading…
Reference in New Issue
Block a user