From 75cb401f0bdafa4a54c8330cebc9206166b01fac Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Bodas Date: Tue, 20 Dec 2022 14:52:06 +0530 Subject: [PATCH] test_messages: Rename helper for clarity. --- zerver/tests/test_messages.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/zerver/tests/test_messages.py b/zerver/tests/test_messages.py index 7adfde139a..dc9cc9e18a 100644 --- a/zerver/tests/test_messages.py +++ b/zerver/tests/test_messages.py @@ -30,7 +30,7 @@ class MissedMessageTest(ZulipTestCase): othello_alerted = False othello_notifications_data = self.create_user_notifications_data_object(user_id=othello.id) - def assert_missing(user_ids: List[int]) -> None: + def assert_active_presence_idle_user_ids(user_ids: List[int]) -> None: presence_idle_user_ids = get_active_presence_idle_user_ids( realm=realm, sender_id=sender.id, @@ -58,7 +58,7 @@ class MissedMessageTest(ZulipTestCase): hamlet_notifications_data.pm_push_notify = True othello_notifications_data.pm_push_notify = True - assert_missing([hamlet.id, othello.id]) + assert_active_presence_idle_user_ids([hamlet.id, othello.id]) # We have already thoroughly tested the `is_notifiable` function elsewhere, # so we needn't test all cases here. This test exists mainly to avoid a bug @@ -69,7 +69,7 @@ class MissedMessageTest(ZulipTestCase): hamlet_notifications_data.pm_push_notify = False othello_notifications_data.pm_push_notify = False hamlet_notifications_data.stream_email_notify = True - assert_missing([hamlet.id]) + assert_active_presence_idle_user_ids([hamlet.id]) # We don't currently send push or email notifications for alert words -- only # desktop notifications, so `is_notifiable` will return False even if the message contains @@ -77,22 +77,22 @@ class MissedMessageTest(ZulipTestCase): # the alert word case in the list. hamlet_notifications_data.stream_email_notify = False hamlet_alerted = True - assert_missing([hamlet.id]) + assert_active_presence_idle_user_ids([hamlet.id]) # Hamlet is idle (and the message has an alert word), so he should be in the list. set_presence(hamlet, "iPhone", ago=5000) - assert_missing([hamlet.id]) + assert_active_presence_idle_user_ids([hamlet.id]) # If Hamlet is active, don't include him in the `presence_idle` list. set_presence(hamlet, "website", ago=15) - assert_missing([]) + assert_active_presence_idle_user_ids([]) # Hamlet is active now, so only Othello should be in the list for a huddle # message. hamlet_alerted = False hamlet_notifications_data.pm_push_notify = False othello_notifications_data.pm_push_notify = True - assert_missing([othello.id]) + assert_active_presence_idle_user_ids([othello.id]) class TestBulkGetHuddleUserIds(ZulipTestCase):