def test_endpoint_absent(self): ''' Test to ensure that the endpoint for a service doesn't exist in Keystone catalog ''' name = 'nova' comment = ('endpoint for service "{0}" is already absent'.format(name)) ret = {'name': name, 'changes': {}, 'result': True, 'comment': comment} mock_lst = MagicMock(side_effect=[[], ['Error']]) with patch.dict(keystone.__salt__, {'keystone.endpoint_get': mock_lst}): self.assertDictEqual(keystone.endpoint_absent(name), ret) with patch.dict(keystone.__opts__, {'test': True}): comt = ( 'Endpoint for service "{0}" will be deleted'.format(name)) ret.update({ 'comment': comt, 'result': None, 'changes': { 'endpoint': 'Will be deleted' } }) self.assertDictEqual(keystone.endpoint_absent(name), ret)
def test_endpoint_absent(self): """ Test to ensure that the endpoint for a service doesn't exist in Keystone catalog """ name = "nova" comment = 'endpoint for service "{0}" is already absent'.format(name) ret = {"name": name, "changes": {}, "result": True, "comment": comment} mock_lst = MagicMock(side_effect=[[], ["Error"]]) with patch.dict(keystone.__salt__, {"keystone.endpoint_get": mock_lst}): self.assertDictEqual(keystone.endpoint_absent(name), ret) with patch.dict(keystone.__opts__, {"test": True}): comt = 'Endpoint for service "{0}" will be deleted'.format(name) ret.update({"comment": comt, "result": None, "changes": {"endpoint": "Will be deleted"}}) self.assertDictEqual(keystone.endpoint_absent(name), ret)
def test_endpoint_absent(self): """ Test to ensure that the endpoint for a service doesn't exist in Keystone catalog """ name = "nova" region = "RegionOne" comment = 'Endpoint for service "{}" is already absent'.format(name) ret = {"name": name, "changes": {}, "result": True, "comment": comment} mock_lst = MagicMock(side_effect=[[], ["Error"]]) with patch.dict(keystone.__salt__, {"keystone.endpoint_get": mock_lst}): self.assertDictEqual(keystone.endpoint_absent(name, region), ret) with patch.dict(keystone.__opts__, {"test": True}): comt = 'Endpoint for service "{}" will be deleted'.format(name) ret.update({"comment": comt, "result": None}) self.assertDictEqual(keystone.endpoint_absent(name, region), ret)
def test_endpoint_absent(self): ''' Test to ensure that the endpoint for a service doesn't exist in Keystone catalog ''' name = 'nova' comment = ('Endpoint for service "{0}" is already absent'.format(name)) ret = {'name': name, 'changes': {}, 'result': True, 'comment': comment} mock_lst = MagicMock(side_effect=[[], ['Error']]) with patch.dict(keystone.__salt__, {'keystone.endpoint_get': mock_lst}): self.assertDictEqual(keystone.endpoint_absent(name), ret) with patch.dict(keystone.__opts__, {'test': True}): comt = ('Endpoint for service "{0}" will be deleted' .format(name)) ret.update({'comment': comt, 'result': None}) self.assertDictEqual(keystone.endpoint_absent(name), ret)