refactored the requires_auth handler to raise exceptions

hopefully cleans up code flow and readability [a tiny bit].
raise an AuthException in auth.py, and catch it in errors.py to
save on returning error_repsonse values throughout the function
This commit is contained in:
Leo Hemsted
2016-06-29 17:37:20 +01:00
parent 39519e3f36
commit 3838715077
3 changed files with 51 additions and 35 deletions

View File

@@ -171,9 +171,9 @@ def test_authentication_returns_token_expired_when_service_uses_expired_key_and_
assert data['message'] == {"token": ['Invalid token: revoked']}
def test_authentication_returns_error_when_api_client_has_no_secrets(notify_api,
notify_db,
notify_db_session):
def test_authentication_returns_error_when_admin_client_has_no_secrets(notify_api,
notify_db,
notify_db_session):
with notify_api.test_request_context():
with notify_api.test_client() as client:
api_secret = notify_api.config.get('ADMIN_CLIENT_SECRET')