From fa5c66c439fc0aa31cdf7f58ea3390b4f85cd53b Mon Sep 17 00:00:00 2001 From: Umair Khan Date: Fri, 12 May 2017 12:55:12 +0500 Subject: [PATCH] push_notifications: Add num_push_devices_for_user tests. --- zerver/tests/test_push_notifications.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index 2152ff0ffd..4be46df3cf 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -632,6 +632,17 @@ class TestSendToPushBouncer(PushNotificationTest): self.assertEqual(exc.exception.error, 'Error received from push notification bouncer') +class TestNumPushDevicesForUser(PushNotificationTest): + def test_when_kind_is_none(self): + # type: () -> None + self.assertEqual(apn.num_push_devices_for_user(self.user_profile), 2) + + def test_when_kind_is_not_none(self): + # type: () -> None + count = apn.num_push_devices_for_user(self.user_profile, + kind=PushDeviceToken.APNS) + self.assertEqual(count, 2) + class TestPushApi(ZulipTestCase): def test_push_api(self): # type: () -> None