Merge "Remove NotificationEventTypeError as not needed"

This commit is contained in:
Jenkins 2016-09-19 11:57:50 +00:00 committed by Gerrit Code Review
commit 6782f9c98b
3 changed files with 8 additions and 7 deletions

View File

@ -611,11 +611,6 @@ class IncompleteLookup(Invalid):
"is required")
class NotificationEventTypeError(IronicException):
_msg_fmt = _('Expected "status" to be one of "start", "end", '
'"error", or "success", but got "%(status)s"')
class NotificationSchemaObjectError(IronicException):
_msg_fmt = _("Expected object %(obj)s when populating notification payload"
" but got object %(source)s")

View File

@ -51,8 +51,6 @@ class EventType(base.IronicObject):
}
def to_event_type_field(self):
if self.status not in ['start', 'end', 'error', 'success']:
raise exception.NotificationEventTypeError(status=self.status)
parts = ['baremetal', self.object, self.action, self.status]
return '.'.join(parts)

View File

@ -246,3 +246,11 @@ class TestNotificationBase(test_base.TestCase):
self.assertRaises(ValueError,
notification.EventType, object="some_obj",
action="some_action", status="invalid")
def test_event_type_make_status_invalid(self):
def make_status_invalid():
event_type.status = "Roar"
event_type = notification.EventType(
object='test_object', action='test', status='start')
self.assertRaises(ValueError, make_status_invalid)