diff --git a/notifications_routing/router.py b/notifications_routing/router.py index 3e1f5b9e28bc8eb47aa7689ef2e6d2d9c5acaba6..ca6d711bb8516200a69ac94f743a1047fd59bb73 100644 --- a/notifications_routing/router.py +++ b/notifications_routing/router.py @@ -65,6 +65,7 @@ class Router(megabus.Listener): str(OutputMessageKeys.CHANNEL_ID): channel[str(InputMessageKeys.ID)], str(OutputMessageKeys.CHANNEL_NAME): channel[str(InputMessageKeys.NAME)], str(OutputMessageKeys.CHANNEL_SLUG): channel[str(InputMessageKeys.SLUG)], + str(OutputMessageKeys.CHANNEL_SHORT_URL): channel[str(InputMessageKeys.SHORT_URL)], str(OutputMessageKeys.PRIORITY): message_json[str(InputMessageKeys.PRIORITY)], str(OutputMessageKeys.CREATED_TIMESTAMP): convert_timestamp_to_local_timezone( message_json[str(InputMessageKeys.SENT_AT)] diff --git a/notifications_routing/utils.py b/notifications_routing/utils.py index 1c10bde9a99e06cea93149d5b50fe0f8d3a7ee14..980cb49593486ba67a0f988dd2353b8348ced63f 100644 --- a/notifications_routing/utils.py +++ b/notifications_routing/utils.py @@ -22,6 +22,7 @@ class InputMessageKeys(StrEnum): NAME = "name" CATEGORY = "category" SLUG = "slug" + SHORT_URL = "shortUrl" PRIORITY = "priority" SENT_AT = "sentAt" BODY = "body" @@ -39,6 +40,7 @@ class OutputMessageKeys(StrEnum): CHANNEL_NAME = "channel_name" CHANNEL_CATEGORY = "category_name" CHANNEL_SLUG = "channel_slug" + CHANNEL_SHORT_URL = "channel_short_url" PRIORITY = "priority" CREATED_TIMESTAMP = "created_timestamp" MESSAGE_BODY = "message_body" diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index c1d6cd4c784c449bca0887d6db9028a31a9bd20b..72ec7d2b3d78dd7c43719915e22c41caef23c7e8 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -127,6 +127,7 @@ def message(): "channel_id": "c3ccc15b-298f-4dc7-877f-2c8970331caf", "channel_name": "Test channel", "channel_slug": "test-channel", + "channel_short_url": "https://cern.ch/thisisanexample", "priority": "NORMAL", "created_timestamp": "2021-02-26T13:59:40.754Z", "message_body": "test", @@ -146,6 +147,7 @@ def message_private(): "channel_id": "c3ccc15b-298f-4dc7-877f-2c8970331caf", "channel_name": "Test channel", "channel_slug": "test-channel", + "channel_short_url": "https://cern.ch/thisisanexample", "priority": "NORMAL", "created_timestamp": "2021-02-26T13:59:40.754Z", "message_body": "test", @@ -165,6 +167,7 @@ def message_intersection(): "channel_id": "c3ccc15b-298f-4dc7-877f-2c8970331caf", "channel_name": "Test channel", "channel_slug": "test-channel", + "channel_short_url": "https://cern.ch/thisisanexample", "priority": "NORMAL", "created_timestamp": "2021-02-26T13:59:40.754Z", "message_body": "test", @@ -184,6 +187,7 @@ def message_critical(): "channel_id": "c3ccc15b-298f-4dc7-877f-2c8970331caf", "channel_name": "Test channel", "channel_slug": "test-channel", + "channel_short_url": "https://cern.ch/thisisanexample", "priority": "CRITICAL", "created_timestamp": "2021-02-26T13:59:40.754Z", "message_body": "test", diff --git a/tests/unit/test_postgres_data_source.py b/tests/unit/test_postgres_data_source.py index 2e3f6ffae76aefa6d2cf3e0494ebc05790821d56..b098189199acc1bad14322f35708d3d6b718bafe 100644 --- a/tests/unit/test_postgres_data_source.py +++ b/tests/unit/test_postgres_data_source.py @@ -35,7 +35,7 @@ def channel(): return Channel( id="c3ccc15b-298f-4dc7-877f-2c8970331caf", slug="test-channel", - name="Test Chanel", + name="Test Channel", groups=[ Group( id="186d8dfc-2774-43a8-91b5-a887fcb6ba4a",