test_push_notifs: Remove gcm_client mock in test_connection_error.

This wasn't doing anything. The test simulates failure to connect to the
bouncer, so the codepaths inside the bouncer don't even get triggered.
This commit is contained in:
Mateusz Mandera 2024-06-16 00:53:14 +02:00 committed by Tim Abbott
parent 2628af9ef4
commit 496aa2a0f1
1 changed files with 2 additions and 8 deletions

View File

@ -3082,14 +3082,8 @@ class HandlePushNotificationTest(PushNotificationTest):
assert settings.PUSH_NOTIFICATION_BOUNCER_URL is not None
URL = settings.PUSH_NOTIFICATION_BOUNCER_URL + "/api/v1/remotes/push/notify"
responses.add(responses.POST, URL, body=ConnectionError())
with mock.patch("zerver.lib.push_notifications.gcm_client") as mock_gcm:
gcm_devices = [
(b64_to_hex(device.token), device.ios_app_id, device.token)
for device in RemotePushDeviceToken.objects.filter(kind=PushDeviceToken.FCM)
]
mock_gcm.json_request.return_value = {"success": {gcm_devices[0][2]: message.id}}
with self.assertRaises(PushNotificationBouncerRetryLaterError):
handle_push_notification(self.user_profile.id, missed_message)
with self.assertRaises(PushNotificationBouncerRetryLaterError):
handle_push_notification(self.user_profile.id, missed_message)
@mock.patch("zerver.lib.push_notifications.push_notifications_configured", return_value=True)
def test_read_message(self, mock_push_notifications: mock.MagicMock) -> None: