mirror of https://github.com/zulip/zulip.git
push_notifications: Remove unnecessary check for no devices.
This should have been checked by the caller anyway.
This commit is contained in:
parent
27a450b58d
commit
b5c107ed27
|
@ -97,8 +97,6 @@ APNS_MAX_RETRIES = 3
|
||||||
@statsd_increment("apple_push_notification")
|
@statsd_increment("apple_push_notification")
|
||||||
def send_apple_push_notification(user_id, devices, payload_data):
|
def send_apple_push_notification(user_id, devices, payload_data):
|
||||||
# type: (int, List[DeviceToken], Dict[str, Any]) -> None
|
# type: (int, List[DeviceToken], Dict[str, Any]) -> None
|
||||||
if not devices:
|
|
||||||
return
|
|
||||||
logging.info("APNs: Sending notification for user %d to %d devices",
|
logging.info("APNs: Sending notification for user %d to %d devices",
|
||||||
user_id, len(devices))
|
user_id, len(devices))
|
||||||
payload = APNsPayload(**modernize_apns_payload(payload_data))
|
payload = APNsPayload(**modernize_apns_payload(payload_data))
|
||||||
|
|
|
@ -574,15 +574,6 @@ class TestAPNs(PushNotificationTest):
|
||||||
"APNs: Success sending for user %d to device %s",
|
"APNs: Success sending for user %d to device %s",
|
||||||
self.user_profile.id, device.token)
|
self.user_profile.id, device.token)
|
||||||
|
|
||||||
def test_success_no_devices(self):
|
|
||||||
# type: () -> None
|
|
||||||
with mock.patch('zerver.lib.push_notifications._apns_client') as mock_apns, \
|
|
||||||
mock.patch('zerver.lib.push_notifications.logging') as mock_logging:
|
|
||||||
mock_apns.get_notification_result.return_value = 'Success'
|
|
||||||
self.send(devices=[])
|
|
||||||
mock_logging.warning.assert_not_called()
|
|
||||||
mock_logging.info.assert_not_called()
|
|
||||||
|
|
||||||
def test_http_retry(self):
|
def test_http_retry(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
import hyper
|
import hyper
|
||||||
|
|
Loading…
Reference in New Issue