Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
post_data = post_data.decode()
except AttributeError:
pass
- log.info("This alarm was triggered: %s", json.dumps(post_data))
+ log.info("This alarm was triggered: %s", post_data)
# Send alarm notification to message bus
try:
- self.notify_alarm(json.dumps(post_data))
+ self.notify_alarm(json.loads(post_data))
except Exception:
log.exception("Error notifying alarm")
class RFile():
def read(self, content_length):
- return post_data
+ return json.dumps(post_data, sort_keys=True)
class MockNotifierHandler(NotifierHandler):
self.handler.do_POST()
set_head.assert_called_once()
- notify.assert_called_with(json.dumps(post_data))
+ notify.assert_called_with(post_data)
@mock.patch.object(KafkaProducer, "notify_alarm")
@mock.patch.object(DatabaseManager, "get_alarm")