mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-17 02:32:32 -05:00
change token expiry err msg for clarity
This commit is contained in:
@@ -82,8 +82,7 @@ def requires_auth():
|
|||||||
continue
|
continue
|
||||||
except TokenExpiredError:
|
except TokenExpiredError:
|
||||||
err_msg = (
|
err_msg = (
|
||||||
"Invalid token: Tokens must be used within 30 seconds, check that your system clock "
|
"Error: Your system clock must be accurate to within 30 seconds"
|
||||||
"is accurate. Try checking https://time.is/"
|
|
||||||
)
|
)
|
||||||
raise AuthError(err_msg, 403, service_id=service.id, api_key_id=api_key.id)
|
raise AuthError(err_msg, 403, service_id=service.id, api_key_id=api_key.id)
|
||||||
|
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ def test_should_return_403_when_token_is_expired(client,
|
|||||||
with pytest.raises(AuthError) as exc:
|
with pytest.raises(AuthError) as exc:
|
||||||
request.headers = {'Authorization': 'Bearer {}'.format(token)}
|
request.headers = {'Authorization': 'Bearer {}'.format(token)}
|
||||||
requires_auth()
|
requires_auth()
|
||||||
assert 'check that your system clock is accurate' in exc.value.short_message
|
assert exc.value.short_message == 'Error: Your system clock must be accurate to within 30 seconds'
|
||||||
assert exc.value.service_id == sample_api_key.service_id
|
assert exc.value.service_id == sample_api_key.service_id
|
||||||
assert exc.value.api_key_id == sample_api_key.id
|
assert exc.value.api_key_id == sample_api_key.id
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user