Show separate error messages for team key

Although using a team key is functionally the same as your service being
restricted, conflating the two errors is not helpful. What we typically
saw in research was that someone was using a team key, got the error,
used a live key and got the _same_ error.

This commit adds a new error message that specifically mentions the type
of API key that you’re using.
This commit is contained in:
Chris Hill-Scott
2016-08-10 15:54:53 +01:00
parent 0a429e18b4
commit ebfaa5dac2
2 changed files with 13 additions and 11 deletions

View File

@@ -704,10 +704,9 @@ def test_should_not_send_email_if_team_api_key_and_not_a_service_user(notify_api
app.celery.tasks.send_email.apply_async.assert_not_called()
assert response.status_code == 400
assert [(
'Cant send to this recipient when service is in trial mode see '
'https://www.notifications.service.gov.uk/trial-mode'
)] == json_resp['message']['to']
assert [
'Cant send to this recipient using a team-only API key'
] == json_resp['message']['to']
def test_should_not_send_sms_if_team_api_key_and_not_a_service_user(notify_api, sample_template, mocker):
@@ -730,10 +729,9 @@ def test_should_not_send_sms_if_team_api_key_and_not_a_service_user(notify_api,
app.celery.tasks.send_sms.apply_async.assert_not_called()
assert response.status_code == 400
assert [(
'Cant send to this recipient when service is in trial mode see '
'https://www.notifications.service.gov.uk/trial-mode'
)] == json_resp['message']['to']
assert [
'Cant send to this recipient using a team-only API key'
] == json_resp['message']['to']
def test_should_send_email_if_team_api_key_and_a_service_user(notify_api, sample_email_template, mocker):