mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 16:31:15 -05:00
Use new value of SMS_CHAR_COUNT_LIMIT from utils
Admin, API and utils were all defining a value for SMS_CHAR_COUNT_LIMIT. This value has been updated in notifications-utils to allow text messages to be 4 fragments long and notifications-api now gets the value of SMS_CHAR_COUNT_LIMIT from notifications-utils instead of defining it in config. Also updated some tests to check for the higher limit.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import pytest
|
||||
from freezegun import freeze_time
|
||||
from flask import current_app
|
||||
from notifications_utils import SMS_CHAR_COUNT_LIMIT
|
||||
|
||||
import app
|
||||
from app.models import INTERNATIONAL_SMS_TYPE, SMS_TYPE, EMAIL_TYPE, LETTER_TYPE
|
||||
@@ -264,18 +265,18 @@ def test_service_can_send_to_recipient_fails_when_mobile_number_is_not_on_team(n
|
||||
assert e.value.fields == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize('char_count', [495, 0, 494, 200])
|
||||
@pytest.mark.parametrize('char_count', [612, 0, 494, 200])
|
||||
def test_check_sms_content_char_count_passes(char_count, notify_api):
|
||||
assert check_sms_content_char_count(char_count) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('char_count', [496, 500, 6000])
|
||||
@pytest.mark.parametrize('char_count', [613, 700, 6000])
|
||||
def test_check_sms_content_char_count_fails(char_count, notify_api):
|
||||
with pytest.raises(BadRequestError) as e:
|
||||
check_sms_content_char_count(char_count)
|
||||
assert e.value.status_code == 400
|
||||
assert e.value.message == 'Content for template has a character count greater than the limit of {}'.format(
|
||||
notify_api.config['SMS_CHAR_COUNT_LIMIT'])
|
||||
SMS_CHAR_COUNT_LIMIT)
|
||||
assert e.value.fields == []
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user