From 6f87091120a1480790c71de989b2a74510964e05 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 25 Apr 2018 22:08:44 -0700 Subject: [PATCH] test_push_notifications: Cover the last lines of validate_api_key. This push notification bouncer error case wasn't previously tested. --- zerver/tests/test_push_notifications.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index b5a73bb767..41f5c20ba9 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -140,6 +140,13 @@ class PushBouncerNotificationTest(BouncerTestCase): 'token': token}) self.assert_json_error(result, "Must validate with valid Zulip server API key") + result = self.api_post(self.server_uuid, endpoint, {'user_id': user_id, + 'token_kind': token_kind, + 'token': token}, + subdomain="zulip") + self.assert_json_error(result, "Invalid subdomain for push notifications bouncer", + status_code=401) + # We do a bit of hackery here to the API_KEYS cache just to # make the code simple for sending an incorrect API key. from zerver.lib.test_classes import API_KEYS