Update validators to use is_message_too_long()

- update check_sms_content_char_count to use the SMSTemplate.is_message_too_long function, and updated the error message to align with the message returned by the admin app.
- Update the the code used by version 1 of the api to use the validate_template method.
  - I did find a couple of services still using the old api, however, this change should not affect them as I checked the messages being sent and they are not too long.
  - We will be sending a message to them to see if they can upgrade.
- Update the log message for authenication to include the URL - makes it easier to track if a service is using version 1 of the api.
This commit is contained in:
Rebecca Law
2020-03-04 17:04:11 +00:00
parent 08ec06295a
commit a994e8fb6e
8 changed files with 63 additions and 35 deletions

View File

@@ -99,8 +99,8 @@ def test_send_notification_invalid_template_id(notify_api, sample_template, mock
json_resp = json.loads(response.get_data(as_text=True))
mocked.assert_not_called()
assert response.status_code == 404
test_string = 'No result found'
assert response.status_code == 400
test_string = 'Template not found'
assert test_string in json_resp['message']
@@ -315,8 +315,8 @@ def test_should_not_allow_template_from_another_service(notify_api,
json_resp = json.loads(response.get_data(as_text=True))
mocked.assert_not_called()
assert response.status_code == 404
test_string = 'No result found'
assert response.status_code == 400
test_string = 'Template not found'
assert test_string in json_resp['message']