push_notifications: Provide a stable ordering.

Otherwise, this can cause test failures based on internals of the database.
This commit is contained in:
Alex Vandiver 2024-05-30 18:52:29 +00:00 committed by Tim Abbott
parent 53b30ed65d
commit 04450389e1
2 changed files with 3 additions and 3 deletions

View File

@ -726,7 +726,7 @@ class PushBouncerNotificationTest(BouncerTestCase):
) )
android_push.assert_called_once_with( android_push.assert_called_once_with(
user_identity, user_identity,
list(reversed(uuid_android_tokens)), uuid_android_tokens,
{"event": "remove", "zulip_message_ids": ",".join(str(i) for i in range(50, 250))}, {"event": "remove", "zulip_message_ids": ",".join(str(i) for i in range(50, 250))},
{}, {},
remote=server, remote=server,

View File

@ -568,7 +568,7 @@ def remote_server_notify_push(
user_identity.filter_q(), user_identity.filter_q(),
kind=RemotePushDeviceToken.GCM, kind=RemotePushDeviceToken.GCM,
server=server, server=server,
) ).order_by("id")
) )
if android_devices and user_id is not None and user_uuid is not None: if android_devices and user_id is not None and user_uuid is not None:
android_devices = delete_duplicate_registrations( android_devices = delete_duplicate_registrations(
@ -580,7 +580,7 @@ def remote_server_notify_push(
user_identity.filter_q(), user_identity.filter_q(),
kind=RemotePushDeviceToken.APNS, kind=RemotePushDeviceToken.APNS,
server=server, server=server,
) ).order_by("id")
) )
if apple_devices and user_id is not None and user_uuid is not None: if apple_devices and user_id is not None and user_uuid is not None:
apple_devices = delete_duplicate_registrations(apple_devices, server.id, user_id, user_uuid) apple_devices = delete_duplicate_registrations(apple_devices, server.id, user_id, user_uuid)