From e023ad612b1c544b94cfba5246cb29905577fb4e Mon Sep 17 00:00:00 2001 From: jrconlin Date: Tue, 13 Aug 2019 15:45:34 -0700 Subject: [PATCH] bug: Return correct status code/errno for ADM auth failures Closes: #1345 --- autopush/router/adm.py | 4 ++-- autopush/tests/test_integration.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/autopush/router/adm.py b/autopush/router/adm.py index 5e36de3f..8ae1217b 100644 --- a/autopush/router/adm.py +++ b/autopush/router/adm.py @@ -202,8 +202,8 @@ def _route(self, notification, uaid_data): self._base_tags, reason="auth failure" )) - raise RouterException("Server error", status_code=500, - errno=902, + raise RouterException("Server error", status_code=502, + errno=901, log_exception=False) except Exception as e: self.log.error("Unhandled exception in ADM Routing: %s" % e) diff --git a/autopush/tests/test_integration.py b/autopush/tests/test_integration.py index 77c5ae45..82e3ef7d 100644 --- a/autopush/tests/test_integration.py +++ b/autopush/tests/test_integration.py @@ -2154,7 +2154,7 @@ def test_bad_token_refresh(self): }), body=data ) - assert response.code == 500 + assert response.code == 502 self.flushLoggedErrors() @inlineCallbacks @@ -2192,9 +2192,9 @@ def test_bad_sends(self): }), body="BunchOfStuff" ) - assert response.code == 500 + assert response.code == 502 rbody = json.loads(body) - assert rbody["errno"] == 902 + assert rbody["errno"] == 901 self.flushLoggedErrors() # fake a valid ADM key