From eb3ad83560747b6a486001751bbf7121c480cd50 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 3 Dec 2021 16:54:29 -0800 Subject: [PATCH] test_push_notifications: Sort pm_users list. The production code sorts this list, so this test would fail nondeterministically if the database returned these elements in another order. --- zerver/tests/test_push_notifications.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index 9f50a688ab..4d6cd13119 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -1622,8 +1622,10 @@ class TestGetAPNsPayload(PushNotificationTest): "message_ids": [message.id], "recipient_type": "private", "pm_users": ",".join( - str(s.user_profile_id) - for s in Subscription.objects.filter(recipient=message.recipient) + sorted( + str(s.user_profile_id) + for s in Subscription.objects.filter(recipient=message.recipient) + ) ), "sender_email": self.sender.email, "sender_id": self.sender.id, @@ -1786,8 +1788,10 @@ class TestGetAPNsPayload(PushNotificationTest): "message_ids": [message.id], "recipient_type": "private", "pm_users": ",".join( - str(s.user_profile_id) - for s in Subscription.objects.filter(recipient=message.recipient) + sorted( + str(s.user_profile_id) + for s in Subscription.objects.filter(recipient=message.recipient) + ) ), "sender_email": self.sender.email, "sender_id": self.sender.id,