From 13d383a50cdbeb2a091132525797709f62cbfea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Wed, 12 Oct 2016 08:59:24 -0400 Subject: [PATCH] Rename exception class to be consistent with the code base Change-Id: Iffcfad802a1e588ed3886f9573ddaec675b82d55 --- almanach/adapters/api_route_v1.py | 2 +- almanach/core/controller.py | 2 +- almanach/core/exception.py | 2 +- tests/core/test_controller.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/almanach/adapters/api_route_v1.py b/almanach/adapters/api_route_v1.py index 2972945..1194b55 100644 --- a/almanach/adapters/api_route_v1.py +++ b/almanach/adapters/api_route_v1.py @@ -52,7 +52,7 @@ def to_json(api_call): except exception.InvalidAttributeException as e: logging.warning(e.get_error_message()) return encode({"error": e.get_error_message()}), 400, {"Content-Type": "application/json"} - except exception.MultipleEntitiesMatchingQuery as e: + except exception.MultipleEntitiesMatchingQueryException as e: logging.warning(e.message) return encode({"error": "Multiple entities found while updating closed"}), 400, { "Content-Type": "application/json"} diff --git a/almanach/core/controller.py b/almanach/core/controller.py index 1b5892a..d8264d7 100644 --- a/almanach/core/controller.py +++ b/almanach/core/controller.py @@ -100,7 +100,7 @@ class Controller(object): def update_inactive_entity(self, instance_id, start, end, **kwargs): inactive_entities = self.database_adapter.list_entities_by_id(instance_id, start, end) if len(inactive_entities) > 1: - raise exception.MultipleEntitiesMatchingQuery() + raise exception.MultipleEntitiesMatchingQueryException() if len(inactive_entities) < 1: raise exception.AlmanachEntityNotFoundException( "InstanceId: {0} Not Found with start".format(instance_id)) diff --git a/almanach/core/exception.py b/almanach/core/exception.py index c39c2cf..de5b0b4 100644 --- a/almanach/core/exception.py +++ b/almanach/core/exception.py @@ -35,7 +35,7 @@ class DateFormatException(AlmanachException): super(DateFormatException, self).__init__(message) -class MultipleEntitiesMatchingQuery(AlmanachException): +class MultipleEntitiesMatchingQueryException(AlmanachException): pass diff --git a/tests/core/test_controller.py b/tests/core/test_controller.py index a4cc2d7..869264d 100644 --- a/tests/core/test_controller.py +++ b/tests/core/test_controller.py @@ -143,7 +143,7 @@ class ControllerTest(unittest.TestCase): start=fake_instances[0].start, end=fake_instances[0].end, flavor=fake_instances[0].flavor), - raises(exception.MultipleEntitiesMatchingQuery) + raises(exception.MultipleEntitiesMatchingQueryException) ) def test_update_one_close_entity_return_no_entity(self):