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