Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
push_notification: Improve logged message when `apns_context` is None.
Prakhar Pratyush25630f316be2
diff --git a/zerver/tests/test_e2ee_push_notifications.py b/zerver/tests/test_e2ee_push_notifications.pyindex de4513bb71c..ba6f9af401f 100644--- a/zerver/tests/test_e2ee_push_notifications.py+++ b/zerver/tests/test_e2ee_push_notifications.py@@ -221,7 +221,7 @@ class SendPushNotificationTest(E2EEPushNotificationTestCase):self.mock_fcm() as mock_fcm_messaging,mock.patch("zilencer.lib.push_notifications.get_apns_context", return_value=None),self.assertLogs("zerver.lib.push_notifications", level="INFO") as zerver_logger,- self.assertLogs("zilencer.lib.push_notifications", level="DEBUG") as zilencer_logger,+ self.assertLogs("zilencer.lib.push_notifications", level="WARNING") as zilencer_logger,mock.patch("time.perf_counter", side_effect=[10.0, 12.0]),):mock_fcm_messaging.send_each.return_value = self.make_fcm_error_response(@@ -238,9 +238,8 @@ class SendPushNotificationTest(E2EEPushNotificationTestCase):zerver_logger.output[0],)self.assertEqual(- "DEBUG:zilencer.lib.push_notifications:"- "APNs: Dropping a notification because nothing configured. "- "Set ZULIP_SERVICES_URL (or APNS_CERT_FILE).",+ "ERROR:zilencer.lib.push_notifications:"+ "APNs: Dropping push notifications since neither APNS_TOKEN_KEY_FILE nor APNS_CERT_FILE is set.",zilencer_logger.output[0],)self.assertIn(diff --git a/zilencer/lib/push_notifications.py b/zilencer/lib/push_notifications.pyindex e25947f38e1..f1f5466600a 100644--- a/zilencer/lib/push_notifications.py+++ b/zilencer/lib/push_notifications.py@@ -40,9 +40,9 @@ def send_e2ee_push_notification_apple(apns_context = get_apns_context()if apns_context is None:- logger.debug(- "APNs: Dropping a notification because nothing configured. "- "Set ZULIP_SERVICES_URL (or APNS_CERT_FILE)."+ logger.error(+ "APNs: Dropping push notifications since "+ "neither APNS_TOKEN_KEY_FILE nor APNS_CERT_FILE is set.")return SentPushNotificationResult(successfully_sent_count=successfully_sent_count,