Make fake MBS messages JSON serializable.

Which prevents errors when fedmsg-hub tries to checkpoint its progress
on disk in prod.
This commit is contained in:
Ralph Bean
2017-03-03 07:00:36 -05:00
parent f12d6e0394
commit 57e96c422e

View File

@@ -78,6 +78,9 @@ class BaseMessage(object):
""" Used to trick moksha into thinking we are a dict. """
return getattr(self, key, value)
def __json__(self):
return dict(msg_id=self.msg_id, topic=self.topic, body=self.body)
@staticmethod
def from_amq(topic, msg):
msg_obj = None