fix tests

This commit is contained in:
Kenneth Kehl
2024-04-12 09:23:22 -07:00
parent 906609e4de
commit 0f3cdcf56a
14 changed files with 93 additions and 71 deletions

View File

@@ -76,7 +76,7 @@ def test_persist_notification_creates_and_save_to_db(
notification = persist_notification(
template_id=sample_template.id,
template_version=sample_template.version,
recipient="+447111111111",
recipient="+14254147755",
service=sample_template.service,
personalisation={},
notification_type=NotificationType.SMS,
@@ -120,7 +120,7 @@ def test_persist_notification_throws_exception_when_missing_template(sample_api_
persist_notification(
template_id=None,
template_version=None,
recipient="+447111111111",
recipient="+14254147755",
service=sample_api_key.service,
personalisation=None,
notification_type=NotificationType.SMS,
@@ -178,7 +178,7 @@ def test_persist_notification_cache_is_not_incremented_on_failure_to_create_noti
persist_notification(
template_id=None,
template_version=None,
recipient="+447111111111",
recipient="+14254147755",
service=sample_api_key.service,
personalisation=None,
notification_type=NotificationType.SMS,
@@ -321,9 +321,9 @@ def test_simulated_recipient(notify_api, to_address, notification_type, expected
@pytest.mark.parametrize(
"recipient, expected_international, expected_prefix, expected_units",
[
("+447900900123", True, "44", 1), # UK
("+73122345678", True, "7", 1), # Russia
("+360623400400", True, "36", 1), # Hungary
# ("+447900900123", True, "44", 1), # UK
# ("+73122345678", True, "7", 1), # Russia
# ("+360623400400", True, "36", 1), # Hungary
("2028675309", False, "1", 1),
], # USA
)
@@ -382,7 +382,7 @@ def test_persist_notification_with_international_info_does_not_store_for_email(
@pytest.mark.parametrize(
"recipient, expected_recipient_normalised",
[
("+4407900900123", "+447900900123"),
# ("+4407900900123", "+447900900123"),
("202-867-5309", "+12028675309"),
("1 202-867-5309", "+12028675309"),
("+1 (202) 867-5309", "+12028675309"),

View File

@@ -165,7 +165,7 @@ def test_service_can_send_to_recipient_passes(key_type, notify_db_session):
"user_number, recipient_number",
[
["+12028675309", "202-867-5309"],
["+447513332413", "+44 (07513) 332413"],
# ["+447513332413", "+44 (07513) 332413"],
],
)
def test_service_can_send_to_recipient_passes_with_non_normalized_number(
@@ -569,6 +569,9 @@ def test_check_rate_limiting_validates_api_rate_limit_and_daily_limit(
@pytest.mark.parametrize("key_type", [KeyType.TEST, KeyType.NORMAL])
@pytest.mark.skip(
"We currently don't support international numbers, our validation fails before here"
)
def test_validate_and_format_recipient_fails_when_international_number_and_service_does_not_allow_int_sms(
key_type,
notify_db_session,
@@ -588,6 +591,7 @@ def test_validate_and_format_recipient_fails_when_international_number_and_servi
@pytest.mark.parametrize("key_type", [KeyType.TEST, KeyType.NORMAL])
@pytest.mark.skip("We currently don't support international numbers")
def test_validate_and_format_recipient_succeeds_with_international_numbers_if_service_does_allow_int_sms(
key_type, sample_service_full_permissions
):