mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
logging: Change missing push notification keys from error to warning.
This is a configuration problem, but it just means a feature is not enabled, not that attention is required, so it should be a warning, not an error.
This commit is contained in:
@@ -166,7 +166,7 @@ def send_apple_push_notification_to_user(user, alert, **extra_data):
|
||||
def send_apple_push_notification(user_id, devices, **extra_data):
|
||||
# type: (int, List[PushDeviceToken], **Any) -> None
|
||||
if not connection and not dbx_connection:
|
||||
logging.error("Attempting to send push notification, but no connection was found. "
|
||||
logging.warning("Attempting to send push notification, but no connection was found. "
|
||||
"This may be because we could not find the APNS Certificate file.")
|
||||
return
|
||||
|
||||
@@ -223,7 +223,7 @@ def send_android_push_notification_to_user(user_profile, data):
|
||||
def send_android_push_notification(devices, data):
|
||||
# type: (List[PushDeviceToken], Dict[str, Any]) -> None
|
||||
if not gcm:
|
||||
logging.error("Attempting to send a GCM push notification, but no API key was configured")
|
||||
logging.warning("Attempting to send a GCM push notification, but no API key was configured")
|
||||
return
|
||||
reg_ids = [device.token for device in devices]
|
||||
|
||||
|
||||
@@ -422,12 +422,12 @@ class GCMTest(PushNotificationTest):
|
||||
return data
|
||||
|
||||
class GCMNotSetTest(GCMTest):
|
||||
@mock.patch('logging.error')
|
||||
def test_gcm_is_none(self, mock_error):
|
||||
@mock.patch('logging.warning')
|
||||
def test_gcm_is_none(self, mock_warning):
|
||||
# type: (mock.MagicMock) -> None
|
||||
apn.gcm = None
|
||||
apn.send_android_push_notification_to_user(self.user_profile, {})
|
||||
mock_error.assert_called_with("Attempting to send a GCM push "
|
||||
mock_warning.assert_called_with("Attempting to send a GCM push "
|
||||
"notification, but no API key was "
|
||||
"configured")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user