resolved errors

This commit is contained in:
Jayesh Kariya 2015-05-22 10:48:28 +05:30
parent d038b1fdbb
commit f31dc921f5

View File

@ -47,7 +47,7 @@ class MongodbUserTestCase(TestCase):
ret.update({'comment': comt})
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)
with patch.dict(mongodb_user.__salt__,
{'mongodb.user_exists': mock,
@ -56,9 +56,6 @@ class MongodbUserTestCase(TestCase):
ret.update({'comment': comt, 'result': True})
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}):
comt = ('User {0} is not present and needs to be created'
.format(name))
@ -84,7 +81,7 @@ class MongodbUserTestCase(TestCase):
'comment': '',
'changes': {}}
mock = MagicMock(side_effect=[True, True, 'A', False])
mock = MagicMock(side_effect=[True, True, False])
mock_t = MagicMock(return_value=True)
with patch.dict(mongodb_user.__salt__,
{'mongodb.user_exists': mock,
@ -101,13 +98,9 @@ class MongodbUserTestCase(TestCase):
'changes': {name: 'Absent'}})
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'
.format(name))
ret.update({'comment': comt, 'result': True})
ret.update({'comment': comt, 'result': True, 'changes': {}})
self.assertDictEqual(mongodb_user.absent(name), ret)