mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
push_notifications: Improve error message for GCM sending issues.
This addresses one of the sources of confusion in #6993.
This commit is contained in:
@@ -155,7 +155,8 @@ def send_android_push_notification_to_user(user_profile, data):
|
|||||||
def send_android_push_notification(devices, data, remote=False):
|
def send_android_push_notification(devices, data, remote=False):
|
||||||
# type: (List[DeviceToken], Dict[str, Any], bool) -> None
|
# type: (List[DeviceToken], Dict[str, Any], bool) -> None
|
||||||
if not gcm:
|
if not gcm:
|
||||||
logging.warning("Attempting to send a GCM push notification, but no API key was configured")
|
logging.warning("Skipping sending a GCM push notification since "
|
||||||
|
"PUSH_NOTIFICATION_BOUNCER_URL and ANDROID_GCM_API_KEY are both unset")
|
||||||
return
|
return
|
||||||
reg_ids = [device.token for device in devices]
|
reg_ids = [device.token for device in devices]
|
||||||
|
|
||||||
|
|||||||
@@ -965,9 +965,9 @@ class GCMNotSetTest(GCMTest):
|
|||||||
# type: (mock.MagicMock) -> None
|
# type: (mock.MagicMock) -> None
|
||||||
apn.gcm = None
|
apn.gcm = None
|
||||||
apn.send_android_push_notification_to_user(self.user_profile, {})
|
apn.send_android_push_notification_to_user(self.user_profile, {})
|
||||||
mock_warning.assert_called_with("Attempting to send a GCM push "
|
mock_warning.assert_called_with(
|
||||||
"notification, but no API key was "
|
"Skipping sending a GCM push notification since PUSH_NOTIFICATION_BOUNCER_URL "
|
||||||
"configured")
|
"and ANDROID_GCM_API_KEY are both unset")
|
||||||
|
|
||||||
class GCMIOErrorTest(GCMTest):
|
class GCMIOErrorTest(GCMTest):
|
||||||
@mock.patch('zerver.lib.push_notifications.gcm.json_request')
|
@mock.patch('zerver.lib.push_notifications.gcm.json_request')
|
||||||
|
|||||||
Reference in New Issue
Block a user