mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -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:
@@ -6,6 +6,7 @@ from datetime import datetime
|
||||
from flask import (json, current_app)
|
||||
from freezegun import freeze_time
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from notifications_utils import SMS_CHAR_COUNT_LIMIT
|
||||
|
||||
import app
|
||||
from app.dao import notifications_dao
|
||||
@@ -1020,7 +1021,6 @@ def test_create_template_raises_invalid_request_when_content_too_large(
|
||||
content="((long_text))",
|
||||
template_type=template_type
|
||||
)
|
||||
limit = current_app.config.get('SMS_CHAR_COUNT_LIMIT')
|
||||
template = Template.query.get(sample.id)
|
||||
from app.notifications.rest import create_template_object_for_notification
|
||||
try:
|
||||
@@ -1028,13 +1028,14 @@ def test_create_template_raises_invalid_request_when_content_too_large(
|
||||
{'long_text':
|
||||
''.join(
|
||||
random.choice(string.ascii_uppercase + string.digits) for _ in
|
||||
range(limit + 1))})
|
||||
range(SMS_CHAR_COUNT_LIMIT + 1))})
|
||||
if should_error:
|
||||
pytest.fail("expected an InvalidRequest")
|
||||
except InvalidRequest as e:
|
||||
if not should_error:
|
||||
pytest.fail("do not expect an InvalidRequest")
|
||||
assert e.message == {'content': ['Content has a character count greater than the limit of {}'.format(limit)]}
|
||||
assert e.message == {'content': ['Content has a character count greater than the limit of {}'.format(
|
||||
SMS_CHAR_COUNT_LIMIT)]}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("notification_type, send_to",
|
||||
|
||||
Reference in New Issue
Block a user