mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix test_directory
This commit is contained in:
parent
187bc1e61e
commit
0ff9fa498a
2 changed files with 4 additions and 5 deletions
|
@ -758,7 +758,7 @@ def _check_directory_win(name,
|
|||
changes = {}
|
||||
|
||||
if not os.path.isdir(name):
|
||||
changes = {'directory': 'new'}
|
||||
changes = {name: {'directory': 'new'}}
|
||||
else:
|
||||
# Check owner
|
||||
owner = salt.utils.win_dacl.get_owner(name)
|
||||
|
|
|
@ -743,7 +743,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
mock_check = MagicMock(return_value=(
|
||||
None,
|
||||
'The directory "{0}" will be changed'.format(name),
|
||||
{'directory': 'new'}))
|
||||
{name: {'directory': 'new'}}))
|
||||
mock_error = CommandExecutionError
|
||||
with patch.dict(filestate.__salt__, {'config.manage_mode': mock_t,
|
||||
'file.user_to_uid': mock_uid,
|
||||
|
@ -801,16 +801,15 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
group=group),
|
||||
ret)
|
||||
|
||||
with patch.object(os.path, 'isfile', mock_f):
|
||||
with patch.object(os.path, 'isdir', mock_f):
|
||||
with patch.dict(filestate.__opts__, {'test': True}):
|
||||
if salt.utils.is_windows():
|
||||
comt = 'The directory "{0}" will be changed' \
|
||||
''.format(name)
|
||||
p_chg = {'directory': 'new'}
|
||||
else:
|
||||
comt = ('The following files will be changed:\n{0}:'
|
||||
' directory - new\n'.format(name))
|
||||
p_chg = {'/etc/grub.conf': {'directory': 'new'}}
|
||||
p_chg = {'/etc/grub.conf': {'directory': 'new'}}
|
||||
ret.update({
|
||||
'comment': comt,
|
||||
'result': None,
|
||||
|
|
Loading…
Add table
Reference in a new issue