Skip to content
Snippets Groups Projects
Commit e6759f7b authored by Deep Chatterjee's avatar Deep Chatterjee
Browse files

jsonify alert, needed for igwn-alert 0.2.2; fixes #433

bug fix in ceb4c768
parent ceb4c768
No related branches found
No related tags found
1 merge request!892jsonify alert, needed for igwn-alert 0.2.2; fixes #433
"""IGWN alert client."""
import json
from celery.utils.log import get_task_logger
from ..igwn_alert.signals import igwn_alert_received
......@@ -19,6 +21,7 @@ class _IGWNAlertDispatchHandler(DispatchHandler):
return super().__call__(*keys, **kwargs)
def process_args(self, topic, alert):
alert = json.loads(alert)
# Determine GraceDB service URL
try:
try:
......
......@@ -53,6 +53,8 @@ def test_handle_messages(mock_superevents_handle, mock_get_event,
alert['object']['self'] = \
alert['object']['self'].replace('gracedb.ligo.org', 'gracedb.invalid')
# dump back into string
alert = json.dumps(alert)
# Run function under test
igwn_alert.handler.dispatch(node, alert)
mock_superevents_handle.assert_called_once()
......@@ -70,7 +72,8 @@ def test_handle_messages_wrong_server(mock_superevents_handle,
alert = json.loads(payload)
alert['object']['self'] = \
alert['object']['self'].replace('gracedb.ligo.org', 'gracedb2.invalid')
# dump back into string
alert = json.dumps(alert)
# Run function under test
caplog.set_level(logging.WARNING)
igwn_alert.handler.dispatch(node, alert)
......@@ -93,7 +96,8 @@ def test_handle_messages_no_self_link(mock_superevents_handle,
# Manipulate alert content
alert = json.loads(payload)
del alert['object']['self']
# dump back into string
alert = json.dumps(alert)
# Run function under test
caplog.set_level(logging.ERROR)
igwn_alert.handler.dispatch(node, alert)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment