mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
resolved errors
This commit is contained in:
parent
d038b1fdbb
commit
f31dc921f5
@ -47,7 +47,7 @@ class MongodbUserTestCase(TestCase):
|
|||||||
ret.update({'comment': comt})
|
ret.update({'comment': comt})
|
||||||
self.assertDictEqual(mongodb_user.present(name, passwd, port={}), ret)
|
self.assertDictEqual(mongodb_user.present(name, passwd, port={}), ret)
|
||||||
|
|
||||||
mock = MagicMock(side_effect=[True, 'A', False, False])
|
mock = MagicMock(side_effect=[True, False, False])
|
||||||
mock_t = MagicMock(return_value=True)
|
mock_t = MagicMock(return_value=True)
|
||||||
with patch.dict(mongodb_user.__salt__,
|
with patch.dict(mongodb_user.__salt__,
|
||||||
{'mongodb.user_exists': mock,
|
{'mongodb.user_exists': mock,
|
||||||
@ -56,9 +56,6 @@ class MongodbUserTestCase(TestCase):
|
|||||||
ret.update({'comment': comt, 'result': True})
|
ret.update({'comment': comt, 'result': True})
|
||||||
self.assertDictEqual(mongodb_user.present(name, passwd), ret)
|
self.assertDictEqual(mongodb_user.present(name, passwd), ret)
|
||||||
|
|
||||||
ret.update({'comment': 'A', 'result': False})
|
|
||||||
self.assertDictEqual(mongodb_user.present(name, passwd), ret)
|
|
||||||
|
|
||||||
with patch.dict(mongodb_user.__opts__, {'test': True}):
|
with patch.dict(mongodb_user.__opts__, {'test': True}):
|
||||||
comt = ('User {0} is not present and needs to be created'
|
comt = ('User {0} is not present and needs to be created'
|
||||||
.format(name))
|
.format(name))
|
||||||
@ -84,7 +81,7 @@ class MongodbUserTestCase(TestCase):
|
|||||||
'comment': '',
|
'comment': '',
|
||||||
'changes': {}}
|
'changes': {}}
|
||||||
|
|
||||||
mock = MagicMock(side_effect=[True, True, 'A', False])
|
mock = MagicMock(side_effect=[True, True, False])
|
||||||
mock_t = MagicMock(return_value=True)
|
mock_t = MagicMock(return_value=True)
|
||||||
with patch.dict(mongodb_user.__salt__,
|
with patch.dict(mongodb_user.__salt__,
|
||||||
{'mongodb.user_exists': mock,
|
{'mongodb.user_exists': mock,
|
||||||
@ -101,13 +98,9 @@ class MongodbUserTestCase(TestCase):
|
|||||||
'changes': {name: 'Absent'}})
|
'changes': {name: 'Absent'}})
|
||||||
self.assertDictEqual(mongodb_user.absent(name), ret)
|
self.assertDictEqual(mongodb_user.absent(name), ret)
|
||||||
|
|
||||||
ret.update({'comment': 'A', 'result': False,
|
|
||||||
'changes': {}})
|
|
||||||
self.assertDictEqual(mongodb_user.absent(name), ret)
|
|
||||||
|
|
||||||
comt = ('User {0} is not present, so it cannot be removed'
|
comt = ('User {0} is not present, so it cannot be removed'
|
||||||
.format(name))
|
.format(name))
|
||||||
ret.update({'comment': comt, 'result': True})
|
ret.update({'comment': comt, 'result': True, 'changes': {}})
|
||||||
self.assertDictEqual(mongodb_user.absent(name), ret)
|
self.assertDictEqual(mongodb_user.absent(name), ret)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user