Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

push_notifications: Remove unused num_push_devices_for_user function.

Anders Kaseorgfdbde9f9c2ef
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py
index 95a9deeb1da..58e790a589b 100644
--- a/zerver/lib/push_notifications.py
+++ b/zerver/lib/push_notifications.py
@@ -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(
user_profile: UserProfile, token_str: str, kind: int, ios_app_id: Optional[str] = None
) -> PushDeviceToken:
diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py
index ebd16bbdfc4..d21b81174e8 100644
--- a/zerver/tests/test_push_notifications.py
+++ b/zerver/tests/test_push_notifications.py
@@ -44,7 +44,6 @@ from zerver.lib.push_notifications import (
handle_remove_push_notification,
hex_to_b64,
modernize_apns_payload,
- num_push_devices_for_user,
parse_gcm_options,
send_android_push_notification_to_user,
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):
@responses.activate
def test_push_api_error_handling(self) -> None: