mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
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:
@@ -294,8 +294,8 @@ def test_send_one_off_notification_raises_if_message_too_long(persist_mock, noti
|
||||
with pytest.raises(BadRequestError) as e:
|
||||
send_one_off_notification(service.id, post_data)
|
||||
|
||||
assert e.value.message == 'Content for template has a character count greater than the limit of {}'.format(
|
||||
SMS_CHAR_COUNT_LIMIT)
|
||||
assert e.value.message == f'Text messages cannot be longer than {SMS_CHAR_COUNT_LIMIT} characters. ' \
|
||||
f'Your message is {729} characters'
|
||||
|
||||
|
||||
def test_send_one_off_notification_fails_if_created_by_other_service(sample_template):
|
||||
|
||||
Reference in New Issue
Block a user