test_push_notifications: Cover the last lines of validate_api_key.

This push notification bouncer error case wasn't previously tested.
This commit is contained in:
Tim Abbott 2018-04-25 22:08:44 -07:00
parent 2ac67a9c2f
commit 6f87091120
1 changed files with 7 additions and 0 deletions

View File

@ -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