push_notifications: Remove unnecessary check for no devices.

This should have been checked by the caller anyway.
This commit is contained in:
Tim Abbott 2017-10-13 17:27:49 -07:00
parent 27a450b58d
commit b5c107ed27
2 changed files with 0 additions and 11 deletions

View File

@ -97,8 +97,6 @@ APNS_MAX_RETRIES = 3
@statsd_increment("apple_push_notification")
def send_apple_push_notification(user_id, devices, payload_data):
# type: (int, List[DeviceToken], Dict[str, Any]) -> None
if not devices:
return
logging.info("APNs: Sending notification for user %d to %d devices",
user_id, len(devices))
payload = APNsPayload(**modernize_apns_payload(payload_data))

View File

@ -574,15 +574,6 @@ class TestAPNs(PushNotificationTest):
"APNs: Success sending for user %d to device %s",
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):
# type: () -> None
import hyper