push_notifications: Add test for send_notifications_to_bouncer.

This commit is contained in:
Umair Khan 2017-05-11 13:31:31 +05:00 committed by Tim Abbott
parent fab4249893
commit 5907877038
1 changed files with 16 additions and 0 deletions

View File

@ -441,6 +441,22 @@ class TestGetGCMPayload(PushNotificationTest):
}
self.assertDictEqual(payload, expected)
class TestSendNotificationsToBouncer(ZulipTestCase):
@mock.patch('zerver.lib.push_notifications.send_to_push_bouncer')
def test_send_notifications_to_bouncer(self, mock_send):
# type: (mock.MagicMock) -> None
apn.send_notifications_to_bouncer(1, {'apns': True}, {'gcm': True})
post_data = {
'user_id': 1,
'apns_payload': {'apns': True},
'gcm_payload': {'gcm': True},
}
mock_send.assert_called_with('POST',
'notify',
ujson.dumps(post_data),
extra_headers={'Content-type':
'application/json'})
class TestPushApi(ZulipTestCase):
def test_push_api(self):
# type: () -> None