mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Cleaning up "email" from code.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -119,8 +119,8 @@ def test_check_template_is_for_notification_type_fails_when_template_type_does_n
|
||||
notification_type=notification_type, template_type=template_type
|
||||
)
|
||||
assert e.value.status_code == 400
|
||||
error_message = "{0} template is not suitable for {1} notification".format(
|
||||
template_type, notification_type
|
||||
error_message = (
|
||||
f"{template_type} template is not suitable for {notification_type} notification"
|
||||
)
|
||||
assert e.value.message == error_message
|
||||
assert e.value.fields == [{"template": error_message}]
|
||||
@@ -474,7 +474,7 @@ def test_validate_template_calls_all_validators_exception_message_too_long(
|
||||
check_char_count=False,
|
||||
)
|
||||
|
||||
mock_check_type.assert_called_once_with("email", "email")
|
||||
mock_check_type.assert_called_once_with(NotificationType.EMAIL, TemplateType.EMAIL)
|
||||
mock_check_if_active.assert_called_once_with(template)
|
||||
mock_create_conent.assert_called_once_with(template, {})
|
||||
mock_check_not_empty.assert_called_once_with("content")
|
||||
@@ -499,7 +499,7 @@ def test_check_service_over_api_rate_limit_when_exceed_rate_limit_request_fails_
|
||||
check_service_over_api_rate_limit(serialised_service, serialised_api_key)
|
||||
|
||||
assert app.redis_store.exceeded_rate_limit.called_with(
|
||||
"{}-{}".format(str(sample_service.id), api_key.key_type),
|
||||
f"{sample_service.id}-{api_key.key_type}",
|
||||
sample_service.rate_limit,
|
||||
60,
|
||||
)
|
||||
@@ -527,7 +527,7 @@ def test_check_service_over_api_rate_limit_when_rate_limit_has_not_exceeded_limi
|
||||
|
||||
check_service_over_api_rate_limit(serialised_service, serialised_api_key)
|
||||
assert app.redis_store.exceeded_rate_limit.called_with(
|
||||
"{}-{}".format(str(sample_service.id), api_key.key_type), 3000, 60
|
||||
f"{sample_service.id}-{api_key.key_type}", 3000, 60,
|
||||
)
|
||||
|
||||
|
||||
@@ -583,7 +583,7 @@ def test_validate_and_format_recipient_fails_when_international_number_and_servi
|
||||
assert e.value.fields == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize("key_type", ["test", "normal"])
|
||||
@pytest.mark.parametrize("key_type", [KeyType.TEST, KeyType.NORMAL])
|
||||
def test_validate_and_format_recipient_succeeds_with_international_numbers_if_service_does_allow_int_sms(
|
||||
key_type, sample_service_full_permissions
|
||||
):
|
||||
@@ -597,7 +597,7 @@ def test_validate_and_format_recipient_succeeds_with_international_numbers_if_se
|
||||
def test_validate_and_format_recipient_fails_when_no_recipient():
|
||||
with pytest.raises(BadRequestError) as e:
|
||||
validate_and_format_recipient(
|
||||
None, "key_type", "service", "NotificationType.SMS"
|
||||
None, KeyType.NORMAL, "service", NotificationType.SMS,
|
||||
)
|
||||
assert e.value.status_code == 400
|
||||
assert e.value.message == "Recipient can't be empty"
|
||||
@@ -632,8 +632,9 @@ def test_check_service_email_reply_to_id_where_service_id_is_not_found(
|
||||
assert e.value.status_code == 400
|
||||
assert (
|
||||
e.value.message
|
||||
== "email_reply_to_id {} does not exist in database for service id {}".format(
|
||||
reply_to_address.id, fake_uuid
|
||||
== (
|
||||
f"email_reply_to_id {reply_to_address.id} does not exist in database for i"
|
||||
f"service id {fake_uuid}"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -648,8 +649,9 @@ def test_check_service_email_reply_to_id_where_reply_to_id_is_not_found(
|
||||
assert e.value.status_code == 400
|
||||
assert (
|
||||
e.value.message
|
||||
== "email_reply_to_id {} does not exist in database for service id {}".format(
|
||||
fake_uuid, sample_service.id
|
||||
== (
|
||||
f"email_reply_to_id {fake_uuid} does not exist in database for service "
|
||||
f"id {sample_service.id}"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -683,8 +685,9 @@ def test_check_service_sms_sender_id_where_service_id_is_not_found(
|
||||
assert e.value.status_code == 400
|
||||
assert (
|
||||
e.value.message
|
||||
== "sms_sender_id {} does not exist in database for service id {}".format(
|
||||
sms_sender.id, fake_uuid
|
||||
== (
|
||||
f"sms_sender_id {sms_sender.id} does not exist in database for service "
|
||||
f"id {fake_uuid}"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -697,8 +700,9 @@ def test_check_service_sms_sender_id_where_sms_sender_is_not_found(
|
||||
assert e.value.status_code == 400
|
||||
assert (
|
||||
e.value.message
|
||||
== "sms_sender_id {} does not exist in database for service id {}".format(
|
||||
fake_uuid, sample_service.id
|
||||
== (
|
||||
f"sms_sender_id {fake_uuid} does not exist in database for service "
|
||||
f"id {sample_service.id}"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user