Merge pull request #2955 from alphagov/invite-error-msg

Fix error message when invitation has expired
This commit is contained in:
Katie Smith
2020-08-13 10:17:47 +01:00
committed by GitHub
3 changed files with 5 additions and 10 deletions

View File

@@ -35,8 +35,8 @@ def validate_invitation_token(invitation_type, token):
max_age_seconds) max_age_seconds)
except SignatureExpired: except SignatureExpired:
errors = {'invitation': errors = {'invitation':
['Your invitation to GOV.UK Notify has expired. ' 'Your invitation to GOV.UK Notify has expired. '
'Please ask the person that invited you to send you another one']} 'Please ask the person that invited you to send you another one'}
raise InvalidRequest(errors, status_code=400) raise InvalidRequest(errors, status_code=400)
except BadData: except BadData:
errors = {'invitation': 'Somethings wrong with this link. Make sure youve copied the whole thing.'} errors = {'invitation': 'Somethings wrong with this link. Make sure youve copied the whole thing.'}

View File

@@ -19,9 +19,9 @@ def test_validate_invitation_token_for_expired_token_returns_400(client, invitat
assert response.status_code == 400 assert response.status_code == 400
json_resp = json.loads(response.get_data(as_text=True)) json_resp = json.loads(response.get_data(as_text=True))
assert json_resp['result'] == 'error' assert json_resp['result'] == 'error'
assert json_resp['message'] == {'invitation': [ assert json_resp['message'] == {
'Your invitation to GOV.UK Notify has expired. ' 'invitation': 'Your invitation to GOV.UK Notify has expired. '
'Please ask the person that invited you to send you another one']} 'Please ask the person that invited you to send you another one'}
@pytest.mark.parametrize('invitation_type', ['service', 'organisation']) @pytest.mark.parametrize('invitation_type', ['service', 'organisation'])

View File

@@ -57,11 +57,6 @@ def test_load_config_if_cloudfoundry_not_available(reload_config):
assert config.Config.ADMIN_BASE_URL == 'env' assert config.Config.ADMIN_BASE_URL == 'env'
def test_cloudfoundry_config_has_different_defaults():
# these should always be set on Sandbox
assert config.Sandbox.REDIS_ENABLED is False
def test_queue_names_all_queues_correct(): def test_queue_names_all_queues_correct():
# Need to ensure that all_queues() only returns queue names used in API # Need to ensure that all_queues() only returns queue names used in API
queues = QueueNames.all_queues() queues = QueueNames.all_queues()