mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -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,5 +1,6 @@
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
from flask import current_app
|
||||
from notifications_utils import SMS_CHAR_COUNT_LIMIT
|
||||
from notifications_utils.recipients import (
|
||||
validate_and_format_phone_number,
|
||||
validate_and_format_email_address,
|
||||
@@ -115,9 +116,8 @@ def validate_and_format_recipient(send_to, key_type, service, notification_type,
|
||||
|
||||
|
||||
def check_sms_content_char_count(content_count):
|
||||
char_count_limit = current_app.config.get('SMS_CHAR_COUNT_LIMIT')
|
||||
if content_count > char_count_limit:
|
||||
message = 'Content for template has a character count greater than the limit of {}'.format(char_count_limit)
|
||||
if content_count > SMS_CHAR_COUNT_LIMIT:
|
||||
message = 'Content for template has a character count greater than the limit of {}'.format(SMS_CHAR_COUNT_LIMIT)
|
||||
raise BadRequestError(message=message)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user