Rename exception class to be consistent with the code base
Change-Id: Iffcfad802a1e588ed3886f9573ddaec675b82d55
This commit is contained in:
parent
592702b4df
commit
13d383a50c
@ -52,7 +52,7 @@ def to_json(api_call):
|
|||||||
except exception.InvalidAttributeException as e:
|
except exception.InvalidAttributeException as e:
|
||||||
logging.warning(e.get_error_message())
|
logging.warning(e.get_error_message())
|
||||||
return encode({"error": e.get_error_message()}), 400, {"Content-Type": "application/json"}
|
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)
|
logging.warning(e.message)
|
||||||
return encode({"error": "Multiple entities found while updating closed"}), 400, {
|
return encode({"error": "Multiple entities found while updating closed"}), 400, {
|
||||||
"Content-Type": "application/json"}
|
"Content-Type": "application/json"}
|
||||||
|
@ -100,7 +100,7 @@ class Controller(object):
|
|||||||
def update_inactive_entity(self, instance_id, start, end, **kwargs):
|
def update_inactive_entity(self, instance_id, start, end, **kwargs):
|
||||||
inactive_entities = self.database_adapter.list_entities_by_id(instance_id, start, end)
|
inactive_entities = self.database_adapter.list_entities_by_id(instance_id, start, end)
|
||||||
if len(inactive_entities) > 1:
|
if len(inactive_entities) > 1:
|
||||||
raise exception.MultipleEntitiesMatchingQuery()
|
raise exception.MultipleEntitiesMatchingQueryException()
|
||||||
if len(inactive_entities) < 1:
|
if len(inactive_entities) < 1:
|
||||||
raise exception.AlmanachEntityNotFoundException(
|
raise exception.AlmanachEntityNotFoundException(
|
||||||
"InstanceId: {0} Not Found with start".format(instance_id))
|
"InstanceId: {0} Not Found with start".format(instance_id))
|
||||||
|
@ -35,7 +35,7 @@ class DateFormatException(AlmanachException):
|
|||||||
super(DateFormatException, self).__init__(message)
|
super(DateFormatException, self).__init__(message)
|
||||||
|
|
||||||
|
|
||||||
class MultipleEntitiesMatchingQuery(AlmanachException):
|
class MultipleEntitiesMatchingQueryException(AlmanachException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class ControllerTest(unittest.TestCase):
|
|||||||
start=fake_instances[0].start,
|
start=fake_instances[0].start,
|
||||||
end=fake_instances[0].end,
|
end=fake_instances[0].end,
|
||||||
flavor=fake_instances[0].flavor),
|
flavor=fake_instances[0].flavor),
|
||||||
raises(exception.MultipleEntitiesMatchingQuery)
|
raises(exception.MultipleEntitiesMatchingQueryException)
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_update_one_close_entity_return_no_entity(self):
|
def test_update_one_close_entity_return_no_entity(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user