diff --git a/app/errors.py b/app/errors.py index 8b027ba60..2588bd54a 100644 --- a/app/errors.py +++ b/app/errors.py @@ -10,7 +10,6 @@ from app.authentication.auth import AuthError class InvalidRequest(Exception): code = None - link = None fields = [] def __init__(self, message, status_code): @@ -28,7 +27,6 @@ class InvalidRequest(Exception): return { "code": self.code, "message": self.message, - "link": self.link, "fields": self.fields } diff --git a/app/schema_validation/__init__.py b/app/schema_validation/__init__.py index 38837b467..e6a2c9748 100644 --- a/app/schema_validation/__init__.py +++ b/app/schema_validation/__init__.py @@ -21,7 +21,6 @@ def build_error_message(errors, schema): message = { "code": "1001", "message": "Validation error occurred - {}".format(schema['title']), - "link": "link to error documentation (not yet implemented)", "fields": fields } diff --git a/app/v2/errors.py b/app/v2/errors.py index b7bd5f586..b7f7d229c 100644 --- a/app/v2/errors.py +++ b/app/v2/errors.py @@ -11,9 +11,7 @@ from app.errors import InvalidRequest class TooManyRequestsError(InvalidRequest): status_code = 429 - # code and link will be in a static file code = "10429" - link = "link to docs" message_template = 'Exceeded send limits ({}) for today' def __init__(self, sending_limit): @@ -23,7 +21,6 @@ class TooManyRequestsError(InvalidRequest): class BadRequestError(InvalidRequest): status_code = 400 code = 10400 - link = "link to documentation" message = "An error occurred" def __init__(self, fields=[], message=None): diff --git a/tests/app/notifications/test_validators.py b/tests/app/notifications/test_validators.py index e41d5f81c..7855e95eb 100644 --- a/tests/app/notifications/test_validators.py +++ b/tests/app/notifications/test_validators.py @@ -52,7 +52,6 @@ def test_check_template_is_for_notification_type_fails_when_template_type_does_n assert e.value.code == 10400 error_message = '{0} template is not suitable for {1} notification'.format(template_type, notification_type) assert e.value.message == error_message - assert e.value.link == 'link to documentation' assert e.value.fields == [{'template': error_message}] @@ -69,7 +68,6 @@ def test_check_template_is_active_fails(sample_template): assert e.value.status_code == 400 assert e.value.code == 10400 assert e.value.message == 'Template has been deleted' - assert e.value.link == "link to documentation" assert e.value.fields == [{'template': 'Template has been deleted'}] @@ -124,7 +122,6 @@ def test_service_can_send_to_recipient_fails_when_recipient_is_not_on_team(recip assert exec_info.value.status_code == 400 assert exec_info.value.code == 10400 assert exec_info.value.message == error_message - assert exec_info.value.link == 'link to documentation' assert exec_info.value.fields == [] @@ -137,7 +134,6 @@ def test_service_can_send_to_recipient_fails_when_mobile_number_is_not_on_team(n assert e.value.status_code == 400 assert e.value.code == 10400 assert e.value.message == 'Can’t send to this recipient using a team-only API key' - assert e.value.link == 'link to documentation' assert e.value.fields == [] @@ -154,5 +150,4 @@ def test_check_sms_content_char_count_fails(char_count, notify_api): assert e.value.code == 10400 assert e.value.message == 'Content for template has a character count greater than the limit of {}'.format( notify_api.config['SMS_CHAR_COUNT_LIMIT']) - assert e.value.link == 'link to documentation' assert e.value.fields == [] diff --git a/tests/app/v2/notifications/test_notification_schemas.py b/tests/app/v2/notifications/test_notification_schemas.py index 96f9e1284..13ccc1124 100644 --- a/tests/app/v2/notifications/test_notification_schemas.py +++ b/tests/app/v2/notifications/test_notification_schemas.py @@ -33,7 +33,6 @@ def test_post_sms_json_schema_bad_uuid_and_missing_phone_number(): assert {"phone_number": "is a required property"} in error['fields'] assert {"template_id": "not a valid UUID"} in error['fields'] assert error.get('code') == '1001' - assert error.get('link', None) is not None def test_post_sms_schema_with_personalisation_that_is_not_a_dict(): @@ -50,7 +49,6 @@ def test_post_sms_schema_with_personalisation_that_is_not_a_dict(): assert len(error.get('fields')) == 1 assert error['fields'][0] == {"personalisation": "should contain key value pairs"} assert error.get('code') == '1001' - assert error.get('link', None) == 'link to error documentation (not yet implemented)' valid_response = { @@ -87,6 +85,5 @@ def test_post_sms_response_schema_missing_uri(): validate(j, post_sms_response) error = json.loads(e.value.message) assert '1001' == error['code'] - assert 'link to error documentation (not yet implemented)' == error['link'] assert 'Validation error occurred - response v2/notifications/sms' == error['message'] assert [{"uri": "is a required property"}] == error['fields'] diff --git a/tests/app/v2/notifications/test_post_notifications.py b/tests/app/v2/notifications/test_post_notifications.py index bbc07e309..e8e500410 100644 --- a/tests/app/v2/notifications/test_post_notifications.py +++ b/tests/app/v2/notifications/test_post_notifications.py @@ -58,7 +58,6 @@ def test_post_sms_notification_returns_404_and_missing_template(notify_api, samp assert error_json['code'] == 10400 assert error_json['message'] == 'Template not found' assert error_json['fields'] == [{'template': 'Template not found'}] - assert error_json['link'] == 'link to documentation' def test_post_sms_notification_returns_403_and_well_formed_auth_error(notify_api, sample_template): @@ -80,7 +79,6 @@ def test_post_sms_notification_returns_403_and_well_formed_auth_error(notify_api assert error_resp['code'] == 401 assert error_resp['message'] == 'Unauthorized, authentication token must be provided' assert error_resp['fields'] == {'token': ['Unauthorized, authentication token must be provided']} - assert error_resp['link'] == 'link to docs' def test_post_sms_notification_returns_400_and_for_schema_problems(notify_api, sample_template): @@ -102,5 +100,4 @@ def test_post_sms_notification_returns_400_and_for_schema_problems(notify_api, s error_resp = json.loads(response.get_data(as_text=True)) assert error_resp['code'] == '1001' assert error_resp['message'] == 'Validation error occurred - POST v2/notifications/sms' - assert error_resp['link'] == "link to error documentation (not yet implemented)" assert error_resp['fields'] == [{"template_id": "is a required property"}]