push registration: Use standard error message for auth problems.

This avoids adding an unnecessary new translated string.
This commit is contained in:
Tim Abbott 2018-05-04 09:04:01 -07:00
parent 9d6233a457
commit 7cbff8b521
2 changed files with 4 additions and 3 deletions

View File

@ -1396,4 +1396,5 @@ class PushBouncerSignupTest(ZulipTestCase):
contact_email="server-admin@example.com",
)
result = self.client_post("/api/v1/remotes/server/register", request)
self.assert_json_error(result, "zulip_org_id and zulip_org_key do not match.")
self.assert_json_error(result, "Zulip server auth failure: key does not match role %s" %
(zulip_org_id,))

View File

@ -12,7 +12,7 @@ from django.conf import settings
from django.views.decorators.http import require_GET
from django.views.decorators.csrf import csrf_exempt
from zerver.decorator import require_post, zulip_login_required
from zerver.decorator import require_post, zulip_login_required, InvalidZulipServerKeyError
from zerver.lib.exceptions import JsonableError
from zerver.lib.push_notifications import send_android_push_notification, \
send_apple_push_notification
@ -70,7 +70,7 @@ def register_remote_server(
if not created:
if remote_server.api_key != zulip_org_key:
raise JsonableError(err_("zulip_org_id and zulip_org_key do not match."))
raise InvalidZulipServerKeyError(zulip_org_id)
else:
remote_server.hostname = hostname
remote_server.contact_email = contact_email