push_notifications: Remove unused num_push_devices_for_user function.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-08-13 18:25:04 -07:00
committed by Tim Abbott
parent b2239e45ac
commit fdbde9f9c2
2 changed files with 0 additions and 19 deletions

View File

@@ -417,13 +417,6 @@ def send_notifications_to_bouncer(
# #
def num_push_devices_for_user(user_profile: UserProfile, kind: Optional[int] = None) -> int:
if kind is None:
return PushDeviceToken.objects.filter(user=user_profile).count()
else:
return PushDeviceToken.objects.filter(user=user_profile, kind=kind).count()
def add_push_device_token( def add_push_device_token(
user_profile: UserProfile, token_str: str, kind: int, ios_app_id: Optional[str] = None user_profile: UserProfile, token_str: str, kind: int, ios_app_id: Optional[str] = None
) -> PushDeviceToken: ) -> PushDeviceToken:

View File

@@ -44,7 +44,6 @@ from zerver.lib.push_notifications import (
handle_remove_push_notification, handle_remove_push_notification,
hex_to_b64, hex_to_b64,
modernize_apns_payload, modernize_apns_payload,
num_push_devices_for_user,
parse_gcm_options, parse_gcm_options,
send_android_push_notification_to_user, send_android_push_notification_to_user,
send_apple_push_notification, send_apple_push_notification,
@@ -1975,17 +1974,6 @@ class TestSendToPushBouncer(ZulipTestCase):
) )
class TestNumPushDevicesForUser(PushNotificationTest):
def test_when_kind_is_none(self) -> None:
self.setup_apns_tokens()
self.assertEqual(num_push_devices_for_user(self.user_profile), 2)
def test_when_kind_is_not_none(self) -> None:
self.setup_apns_tokens()
count = num_push_devices_for_user(self.user_profile, kind=PushDeviceToken.APNS)
self.assertEqual(count, 2)
class TestPushApi(BouncerTestCase): class TestPushApi(BouncerTestCase):
@responses.activate @responses.activate
def test_push_api_error_handling(self) -> None: def test_push_api_error_handling(self) -> None: