Update file.touch unit tests to reflect addition of changes in test mode

This commit is contained in:
Erik Johnson 2018-09-30 16:45:25 -05:00 committed by Ch3LL
parent 4bc5fd008e
commit 885d6ff281
No known key found for this signature in database
GPG key ID: 132B55A7C13EFA73

View file

@ -1357,14 +1357,18 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
with patch.object(os.path, 'exists', mock_f):
with patch.dict(filestate.__opts__, {'test': True}):
comt = ('File {0} is set to be created'.format(name))
ret.update({'comment': comt, 'result': None})
ret.update({'comment': comt,
'result': None,
'changes': {'new': name}})
self.assertDictEqual(filestate.touch(name), ret)
with patch.dict(filestate.__opts__, {'test': False}):
with patch.object(os.path, 'isdir', mock_f):
comt = ('Directory not present to touch file {0}'
.format(name))
ret.update({'comment': comt, 'result': False})
ret.update({'comment': comt,
'result': False,
'changes': {}})
self.assertDictEqual(filestate.touch(name), ret)
with patch.object(os.path, 'isdir', mock_t):