def test_absent(self): ''' Test to ensure a user does not exist on the Dell DRAC ''' name = 'damian' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} mock = MagicMock(return_value=[]) with patch.dict(drac.__salt__, {'drac.list_users': mock}): with patch.dict(drac.__opts__, {'test': True}): comt = ('`{0}` does not exist'.format(name)) ret.update({'comment': comt}) self.assertDictEqual(drac.absent(name), ret) with patch.dict(drac.__opts__, {'test': False}): comt = ('`{0}` does not exist'.format(name)) ret.update({'comment': comt}) self.assertDictEqual(drac.absent(name), ret)
def test_absent(self): """ Test to ensure a user does not exist on the Dell DRAC """ name = "damian" ret = {"name": name, "result": True, "comment": "", "changes": {}} mock = MagicMock(return_value=[]) with patch.dict(drac.__salt__, {"drac.list_users": mock}): with patch.dict(drac.__opts__, {"test": True}): comt = "`{0}` does not exist".format(name) ret.update({"comment": comt}) self.assertDictEqual(drac.absent(name), ret) with patch.dict(drac.__opts__, {"test": False}): comt = "`{0}` does not exist".format(name) ret.update({"comment": comt}) self.assertDictEqual(drac.absent(name), ret)