This commit is contained in:
Kenneth Kehl
2023-07-13 07:25:19 -07:00
parent cbed8b8104
commit daa74f08d2
2 changed files with 4 additions and 4 deletions

View File

@@ -48,7 +48,7 @@ def check_service_over_api_rate_limit(service, api_key):
raise RateLimitError(rate_limit, interval, api_key.key_type) raise RateLimitError(rate_limit, interval, api_key.key_type)
def check_application_over_daily_message_total(key_type, service): def check_application_over_retention_limit(key_type, service):
if key_type == KEY_TYPE_TEST or not current_app.config['REDIS_ENABLED']: if key_type == KEY_TYPE_TEST or not current_app.config['REDIS_ENABLED']:
return 0 return 0
@@ -71,7 +71,7 @@ def check_application_over_daily_message_total(key_type, service):
def check_rate_limiting(service, api_key): def check_rate_limiting(service, api_key):
check_service_over_api_rate_limit(service, api_key) check_service_over_api_rate_limit(service, api_key)
check_application_over_daily_message_total(api_key.key_type, service) check_application_over_retention_limit(api_key.key_type, service)
def check_template_is_for_notification_type(notification_type, template_type): def check_template_is_for_notification_type(notification_type, template_type):

View File

@@ -10,7 +10,7 @@ from app.notifications.process_notifications import (
create_content_for_notification, create_content_for_notification,
) )
from app.notifications.validators import ( from app.notifications.validators import (
check_application_over_daily_message_total, check_application_over_retention_limit,
check_if_service_can_send_files_by_email, check_if_service_can_send_files_by_email,
check_is_message_too_long, check_is_message_too_long,
check_notification_content_is_not_empty, check_notification_content_is_not_empty,
@@ -56,7 +56,7 @@ def test_check_service_message_limit_over_total_limit_fails(key_type, mocker, no
mocker.patch('app.redis_store.get', return_value="5001") mocker.patch('app.redis_store.get', return_value="5001")
with pytest.raises(TotalRequestsError) as e: with pytest.raises(TotalRequestsError) as e:
check_application_over_daily_message_total(key_type, service) check_application_over_retention_limit(key_type, service)
assert e.value.status_code == 429 assert e.value.status_code == 429
assert e.value.message == 'Exceeded total application limits (5000) for today' assert e.value.message == 'Exceeded total application limits (5000) for today'
assert e.value.fields == [] assert e.value.fields == []