Add serialization of context to FakeNotifier

Currently, the FakeNotifier doesn't do anything to check the context
that will be serialized when the RPC call is made. This change adds
a call to serialize the context to prevent bugs related to the
context passed in to send the notification.

Related-Bug: #1360911

Change-Id: I905f8421bc8e34c52b779d65a88d1ebf044f4dd1
This commit is contained in:
melanie witt 2015-03-31 23:09:50 +00:00
parent 7135af61c1
commit 26e1caa175
1 changed files with 4 additions and 0 deletions

View File

@ -55,6 +55,10 @@ class FakeNotifier(object):
# this permit to raise an exception if something have not
# been serialized correctly
jsonutils.to_primitive(payload)
# NOTE(melwitt): Try to serialize the context, as the rpc would.
# An exception will be raised if something is wrong
# with the context.
self._serializer.serialize_context(ctxt)
msg = FakeMessage(self.publisher_id, priority, event_type,
payload, ctxt)
NOTIFICATIONS.append(msg)