def test_role_absent(self): ''' Test to ensure that the keystone role is absent. ''' name = 'nova' ret = { 'name': name, 'changes': {}, 'result': True, 'comment': 'Role "{0}" is already absent'.format(name) } mock_lst = MagicMock(side_effect=[['Error'], []]) with patch.dict(keystone.__salt__, {'keystone.role_get': mock_lst}): self.assertDictEqual(keystone.role_absent(name), ret) with patch.dict(keystone.__opts__, {'test': True}): comt = ('Role "{0}" will be deleted'.format(name)) ret.update({ 'comment': comt, 'result': None, 'changes': { 'Role': 'Will be deleted' } }) self.assertDictEqual(keystone.role_absent(name), ret)
def test_role_absent(self): """ Test to ensure that the keystone role is absent. """ name = "nova" ret = {"name": name, "changes": {}, "result": True, "comment": 'Role "{0}" is already absent'.format(name)} mock_lst = MagicMock(side_effect=[["Error"], []]) with patch.dict(keystone.__salt__, {"keystone.role_get": mock_lst}): self.assertDictEqual(keystone.role_absent(name), ret) with patch.dict(keystone.__opts__, {"test": True}): comt = 'Role "{0}" will be deleted'.format(name) ret.update({"comment": comt, "result": None, "changes": {"Role": "Will be deleted"}}) self.assertDictEqual(keystone.role_absent(name), ret)
def test_role_absent(self): ''' Test to ensure that the keystone role is absent. ''' name = 'nova' ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Role "{0}" is already absent'.format(name)} mock_lst = MagicMock(side_effect=[['Error'], []]) with patch.dict(keystone.__salt__, {'keystone.role_get': mock_lst}): self.assertDictEqual(keystone.role_absent(name), ret) with patch.dict(keystone.__opts__, {'test': True}): comt = 'Role "{0}" will be deleted'.format(name) ret.update({'comment': comt, 'result': None}) self.assertDictEqual(keystone.role_absent(name), ret)
def test_role_absent(self): """ Test to ensure that the keystone role is absent. """ name = "nova" ret = { "name": name, "changes": {}, "result": True, "comment": 'Role "{}" is already absent'.format(name), } mock_lst = MagicMock(side_effect=[["Error"], []]) with patch.dict(keystone.__salt__, {"keystone.role_get": mock_lst}): self.assertDictEqual(keystone.role_absent(name), ret) with patch.dict(keystone.__opts__, {"test": True}): comt = 'Role "{}" will be deleted'.format(name) ret.update({"comment": comt, "result": None}) self.assertDictEqual(keystone.role_absent(name), ret)