Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_push_notifications: Add a test for FOLLOWED_TOPIC_PUSH trigger.

Prakhar Pratyush46446d0e1dc7
diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py
index 952b7d7521b..b4544f24403 100644
--- a/zerver/tests/test_push_notifications.py
+++ b/zerver/tests/test_push_notifications.py
@@ -2016,10 +2016,10 @@ class TestGetAPNsPayload(PushNotificationTest):
self.assertDictEqual(payload, expected)
mock_push_notifications.assert_called()
- def test_get_message_payload_apns_stream_message(self) -> None:
+ def _test_get_message_payload_apns_stream_message(self, trigger: str) -> None:
stream = Stream.objects.filter(name="Verona").get()
message = self.get_message(Recipient.STREAM, stream.id, stream.realm_id)
- payload = get_message_payload_apns(self.sender, message, NotificationTriggers.STREAM_PUSH)
+ payload = get_message_payload_apns(self.sender, message, trigger)
expected = {
"alert": {
"title": "#Verona > Test topic",
@@ -2046,6 +2046,12 @@ class TestGetAPNsPayload(PushNotificationTest):
}
self.assertDictEqual(payload, expected)
+ def test_get_message_payload_apns_stream_message(self) -> None:
+ self._test_get_message_payload_apns_stream_message(NotificationTriggers.STREAM_PUSH)
+
+ def test_get_message_payload_apns_followed_topic_message(self) -> None:
+ self._test_get_message_payload_apns_stream_message(NotificationTriggers.FOLLOWED_TOPIC_PUSH)
+
def test_get_message_payload_apns_stream_mention(self) -> None:
user_profile = self.example_user("othello")
stream = Stream.objects.filter(name="Verona").get()