Rename check_character_count method to check_is_message_to_long.

Add different error message for email and text if content is too long.
Use utils version with is_message_too_long method implemented for email templates.
This commit is contained in:
Rebecca Law
2020-11-09 15:19:00 +00:00
parent 5bacfc1df9
commit 171bc74c69
6 changed files with 52 additions and 26 deletions

View File

@@ -317,8 +317,9 @@ 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 == f'Text messages cannot be longer than {SMS_CHAR_COUNT_LIMIT} characters. ' \
f'Your message is {1029} characters'
assert e.value.message == f'Your message is too long. ' \
f'Text messages cannot be longer than {SMS_CHAR_COUNT_LIMIT} characters. ' \
f'Your message is {1029} characters long.'
def test_send_one_off_notification_fails_if_created_by_other_service(sample_template):