From 0f3cdcf56a4f2e2b8e82edc4d8d1110881785c29 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 12 Apr 2024 09:23:22 -0700 Subject: [PATCH] fix tests --- poetry.lock | 2 + test_csv_files/multiple_sms.csv | 20 +++++----- test_csv_files/sms.csv | 2 +- tests/app/celery/test_tasks.py | 30 +++++++-------- .../test_process_notification.py | 14 +++---- tests/app/notifications/test_validators.py | 6 ++- .../test_send_notification.py | 8 ++-- .../test_send_one_off_notification.py | 1 + tests/app/service/test_rest.py | 30 ++++++++++----- tests/app/test_model.py | 2 +- tests/app/test_schemas.py | 2 +- tests/app/user/test_rest.py | 7 ++-- tests/app/user/test_rest_verify.py | 3 +- .../notifications/test_post_notifications.py | 37 ++++++++++--------- 14 files changed, 93 insertions(+), 71 deletions(-) diff --git a/poetry.lock b/poetry.lock index b21e31af4..df632df80 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2071,6 +2071,7 @@ files = [ {file = "lxml-5.2.1-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c38d7b9a690b090de999835f0443d8aa93ce5f2064035dfc48f27f02b4afc3d0"}, {file = "lxml-5.2.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5670fb70a828663cc37552a2a85bf2ac38475572b0e9b91283dc09efb52c41d1"}, {file = "lxml-5.2.1-cp36-cp36m-manylinux_2_28_x86_64.whl", hash = "sha256:958244ad566c3ffc385f47dddde4145088a0ab893504b54b52c041987a8c1863"}, + {file = "lxml-5.2.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:b6241d4eee5f89453307c2f2bfa03b50362052ca0af1efecf9fef9a41a22bb4f"}, {file = "lxml-5.2.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:2a66bf12fbd4666dd023b6f51223aed3d9f3b40fef06ce404cb75bafd3d89536"}, {file = "lxml-5.2.1-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:9123716666e25b7b71c4e1789ec829ed18663152008b58544d95b008ed9e21e9"}, {file = "lxml-5.2.1-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:0c3f67e2aeda739d1cc0b1102c9a9129f7dc83901226cc24dd72ba275ced4218"}, @@ -2488,6 +2489,7 @@ files = [ {file = "msgpack-1.0.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fbb160554e319f7b22ecf530a80a3ff496d38e8e07ae763b9e82fadfe96f273"}, {file = "msgpack-1.0.8-cp39-cp39-win32.whl", hash = "sha256:f9af38a89b6a5c04b7d18c492c8ccf2aee7048aff1ce8437c4683bb5a1df893d"}, {file = "msgpack-1.0.8-cp39-cp39-win_amd64.whl", hash = "sha256:ed59dd52075f8fc91da6053b12e8c89e37aa043f8986efd89e61fae69dc1b011"}, + {file = "msgpack-1.0.8-py3-none-any.whl", hash = "sha256:24f727df1e20b9876fa6e95f840a2a2651e34c0ad147676356f4bf5fbb0206ca"}, {file = "msgpack-1.0.8.tar.gz", hash = "sha256:95c02b0e27e706e48d0e5426d1710ca78e0f0628d6e89d5b5a5b91a5f12274f3"}, ] diff --git a/test_csv_files/multiple_sms.csv b/test_csv_files/multiple_sms.csv index 2ecad9140..3253e0ae1 100644 --- a/test_csv_files/multiple_sms.csv +++ b/test_csv_files/multiple_sms.csv @@ -1,11 +1,11 @@ PhoneNumber,Name -+441234123121,chris -+441234123122,chris -+441234123123,chris -+441234123124,chris -+441234123125,chris -+441234123126,chris -+441234123127,chris -+441234123128,chris -+441234123129,chris -+441234123120,chris ++14254147755,chris ++14254147755,chris ++14254147755,chris ++14254147755,chris ++14254147755,chris ++14254147755,chris ++14254147755,chris ++14254147755,chris ++14254147755,chris ++14254147755,chris diff --git a/test_csv_files/sms.csv b/test_csv_files/sms.csv index 728639972..2227cbfe6 100644 --- a/test_csv_files/sms.csv +++ b/test_csv_files/sms.csv @@ -1,2 +1,2 @@ PHONE NUMBER, IGNORE THIS COLUMN -+441234123123, nope ++14254147755, nope diff --git a/tests/app/celery/test_tasks.py b/tests/app/celery/test_tasks.py index 063770bfc..7b1463d2c 100644 --- a/tests/app/celery/test_tasks.py +++ b/tests/app/celery/test_tasks.py @@ -100,14 +100,14 @@ def test_should_process_sms_job(sample_job, mocker): s3.get_job_and_metadata_from_s3.assert_called_once_with( service_id=str(sample_job.service.id), job_id=str(sample_job.id) ) - assert encryption.encrypt.call_args[0][0]["to"] == "+441234123123" + assert encryption.encrypt.call_args[0][0]["to"] == "+14254147755" assert encryption.encrypt.call_args[0][0]["template"] == str(sample_job.template.id) assert ( encryption.encrypt.call_args[0][0]["template_version"] == sample_job.template.version ) assert encryption.encrypt.call_args[0][0]["personalisation"] == { - "phonenumber": "+441234123123" + "phonenumber": "+14254147755" } assert encryption.encrypt.call_args[0][0]["row_number"] == 0 tasks.save_sms.apply_async.assert_called_once_with( @@ -279,7 +279,7 @@ def test_should_process_all_sms_job(sample_job_with_placeholdered_template, mock service_id=str(sample_job_with_placeholdered_template.service.id), job_id=str(sample_job_with_placeholdered_template.id), ) - assert encryption.encrypt.call_args[0][0]["to"] == "+441234123120" + assert encryption.encrypt.call_args[0][0]["to"] == "+14254147755" assert encryption.encrypt.call_args[0][0]["template"] == str( sample_job_with_placeholdered_template.template.id ) @@ -288,7 +288,7 @@ def test_should_process_all_sms_job(sample_job_with_placeholdered_template, mock == sample_job_with_placeholdered_template.template.version ) # noqa assert encryption.encrypt.call_args[0][0]["personalisation"] == { - "phonenumber": "+441234123120", + "phonenumber": "+14254147755", "name": "chris", } assert tasks.save_sms.apply_async.call_count == 10 @@ -397,7 +397,7 @@ def test_should_send_template_to_correct_sms_task_and_persist( ): notification = _notification_json( sample_template_with_placeholders, - to="+447234123123", + to="+14254147755", personalisation={"name": "Jo"}, ) @@ -558,7 +558,7 @@ def test_should_not_save_email_if_restricted_service_and_invalid_email_address( def test_should_save_sms_template_to_and_persist_with_job_id(sample_job, mocker): notification = _notification_json( sample_job.template, - to="+447234123123", + to="+14254147755", job_id=sample_job.id, row_number=2, ) @@ -813,7 +813,7 @@ def test_should_use_email_template_and_persist_without_personalisation( def test_save_sms_should_go_to_retry_queue_if_database_errors(sample_template, mocker): - notification = _notification_json(sample_template, "+447234123123") + notification = _notification_json(sample_template, "+14254147755") expected_exception = SQLAlchemyError() @@ -1017,7 +1017,7 @@ def test_send_inbound_sms_to_service_post_https_request_to_service( inbound_sms = create_inbound_sms( service=sample_service, notify_number="0751421", - user_number="447700900111", + user_number="+14254147755", provider_date=datetime(2017, 6, 20), content="Here is some content", ) @@ -1063,7 +1063,7 @@ def test_send_inbound_sms_to_service_does_not_sent_request_when_inbound_api_does inbound_sms = create_inbound_sms( service=sample_service, notify_number="0751421", - user_number="447700900111", + user_number="+14254147755", provider_date=datetime(2017, 6, 20), content="Here is some content", ) @@ -1084,7 +1084,7 @@ def test_send_inbound_sms_to_service_retries_if_request_returns_500( inbound_sms = create_inbound_sms( service=sample_service, notify_number="0751421", - user_number="447700900111", + user_number="+14254147755", provider_date=datetime(2017, 6, 20), content="Here is some content", ) @@ -1109,7 +1109,7 @@ def test_send_inbound_sms_to_service_retries_if_request_throws_unknown( inbound_sms = create_inbound_sms( service=sample_service, notify_number="0751421", - user_number="447700900111", + user_number="+14254147755", provider_date=datetime(2017, 6, 20), content="Here is some content", ) @@ -1134,7 +1134,7 @@ def test_send_inbound_sms_to_service_does_not_retries_if_request_returns_404( inbound_sms = create_inbound_sms( service=sample_service, notify_number="0751421", - user_number="447700900111", + user_number="+14254147755", provider_date=datetime(2017, 6, 20), content="Here is some content", ) @@ -1429,7 +1429,7 @@ def test_save_api_email_or_sms(mocker, sample_service, notification_type): data.update({"to": "jane.citizen@example.com"}) expected_queue = QueueNames.SEND_EMAIL else: - data.update({"to": "+447700900855"}) + data.update({"to": "+14254147755"}) expected_queue = QueueNames.SEND_SMS encrypted = encryption.encrypt(data) @@ -1483,7 +1483,7 @@ def test_save_api_email_dont_retry_if_notification_already_exists( data.update({"to": "jane.citizen@example.com"}) expected_queue = QueueNames.SEND_EMAIL else: - data.update({"to": "+447700900855"}) + data.update({"to": "+14254147755"}) expected_queue = QueueNames.SEND_SMS encrypted = encryption.encrypt(data) @@ -1576,7 +1576,7 @@ def test_save_tasks_use_cached_service_and_template( NotificationType.SMS, save_api_sms, QueueNames.SEND_SMS, - "+447700900855", + "+14254147755", ), ( NotificationType.EMAIL, diff --git a/tests/app/notifications/test_process_notification.py b/tests/app/notifications/test_process_notification.py index 52198071a..160c96f97 100644 --- a/tests/app/notifications/test_process_notification.py +++ b/tests/app/notifications/test_process_notification.py @@ -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"), diff --git a/tests/app/notifications/test_validators.py b/tests/app/notifications/test_validators.py index 7dcb8dd1d..42d96c93d 100644 --- a/tests/app/notifications/test_validators.py +++ b/tests/app/notifications/test_validators.py @@ -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 ): diff --git a/tests/app/service/send_notification/test_send_notification.py b/tests/app/service/send_notification/test_send_notification.py index d85cb939a..b1bd27988 100644 --- a/tests/app/service/send_notification/test_send_notification.py +++ b/tests/app/service/send_notification/test_send_notification.py @@ -89,7 +89,7 @@ def test_should_reject_bad_phone_numbers(notify_api, sample_template, mocker): @pytest.mark.parametrize( "template_type, to", [ - (TemplateType.SMS, "+447700900855"), + (TemplateType.SMS, "+14254147755"), (TemplateType.EMAIL, "ok@ok.com"), ], ) @@ -257,7 +257,7 @@ def test_should_not_send_notification_for_archived_template( sample_template.archived = True dao_update_template(sample_template) json_data = json.dumps( - {"to": "+447700900855", "template": sample_template.id} + {"to": "+14254147755", "template": sample_template.id} ) auth_header = create_service_authorization_header( service_id=sample_template.service_id @@ -276,7 +276,7 @@ def test_should_not_send_notification_for_archived_template( @pytest.mark.parametrize( "template_type, to", [ - (TemplateType.SMS, "+447700900855"), + (TemplateType.SMS, "+16618675309"), (TemplateType.EMAIL, "not-someone-we-trust@email-address.com"), ], ) @@ -1230,6 +1230,7 @@ def test_should_allow_store_original_number_on_sms_notification( assert "1" == notifications[0].to +@pytest.mark.skip("We don't support international at moment") def test_should_not_allow_sending_to_international_number_without_international_permission( client, sample_template, mocker ): @@ -1254,6 +1255,7 @@ def test_should_not_allow_sending_to_international_number_without_international_ assert error_json["message"] == "Cannot send to international mobile numbers" +@pytest.mark.skip("We don't support international at the moment") def test_should_allow_sending_to_international_number_with_international_permission( client, sample_service_full_permissions, mocker ): diff --git a/tests/app/service/send_notification/test_send_one_off_notification.py b/tests/app/service/send_notification/test_send_one_off_notification.py index 231b42be0..000e22005 100644 --- a/tests/app/service/send_notification/test_send_one_off_notification.py +++ b/tests/app/service/send_notification/test_send_one_off_notification.py @@ -98,6 +98,7 @@ def test_send_one_off_notification_calls_persist_correctly_for_sms( ) +@pytest.mark.skip("We currently don't support international") def test_send_one_off_notification_calls_persist_correctly_for_international_sms( persist_mock, celery_mock, notify_db_session ): diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index d1691c847..5535f814b 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -65,10 +65,20 @@ def test_get_service_list(client, service_factory): response = client.get("/service", headers=[auth_header]) assert response.status_code == 200 json_resp = json.loads(response.get_data(as_text=True)) - assert len(json_resp["data"]) == 3 - assert json_resp["data"][0]["name"] == "one" - assert json_resp["data"][1]["name"] == "two" - assert json_resp["data"][2]["name"] == "three" + + found_service_one = False + found_service_two = False + found_service_three = False + for item in json_resp["data"]: + if item["name"] == "one": + found_service_one = True + elif item["name"] == "two": + found_service_two = True + elif item["name"] == "three": + found_service_three = True + assert found_service_one is True + assert found_service_two is True + assert found_service_three is True def test_get_service_list_with_only_active_flag(client, service_factory): @@ -1262,7 +1272,7 @@ def test_add_existing_user_to_another_service_with_all_permissions( name="Invited User", email_address="invited@digital.fake.gov", password="password", - mobile_number="+4477123456", + mobile_number="+14254147755", ) # they must exist in db first save_model_user(user_to_add, validated_email_access=True) @@ -1332,7 +1342,7 @@ def test_add_existing_user_to_another_service_with_send_permissions( name="Invited User", email_address="invited@digital.fake.gov", password="password", - mobile_number="+4477123456", + mobile_number="+14254147755", ) save_model_user(user_to_add, validated_email_access=True) @@ -1382,7 +1392,7 @@ def test_add_existing_user_to_another_service_with_manage_permissions( name="Invited User", email_address="invited@digital.fake.gov", password="password", - mobile_number="+4477123456", + mobile_number="+14254147755", ) save_model_user(user_to_add, validated_email_access=True) @@ -1433,7 +1443,7 @@ def test_add_existing_user_to_another_service_with_folder_permissions( name="Invited User", email_address="invited@digital.fake.gov", password="password", - mobile_number="+4477123456", + mobile_number="+14254147755", ) save_model_user(user_to_add, validated_email_access=True) @@ -1474,7 +1484,7 @@ def test_add_existing_user_to_another_service_with_manage_api_keys( name="Invited User", email_address="invited@digital.fake.gov", password="password", - mobile_number="+4477123456", + mobile_number="+14254147755", ) save_model_user(user_to_add, validated_email_access=True) @@ -1514,7 +1524,7 @@ def test_add_existing_user_to_non_existing_service_returns404( name="Invited User", email_address="invited@digital.fake.gov", password="password", - mobile_number="+4477123456", + mobile_number="+14254147755", ) save_model_user(user_to_add, validated_email_access=True) diff --git a/tests/app/test_model.py b/tests/app/test_model.py index bbd670412..aab74fac8 100644 --- a/tests/app/test_model.py +++ b/tests/app/test_model.py @@ -39,7 +39,7 @@ ) -@pytest.mark.parametrize("mobile_number", ["+447700900855", "+12348675309"]) +@pytest.mark.parametrize("mobile_number", ["+14254147755", "+12348675309"]) def test_should_build_service_guest_list_from_mobile_number(mobile_number): service_guest_list = ServiceGuestList.from_string( "service_id", diff --git a/tests/app/test_schemas.py b/tests/app/test_schemas.py index 55be8a6bb..151e319fb 100644 --- a/tests/app/test_schemas.py +++ b/tests/app/test_schemas.py @@ -60,7 +60,7 @@ def test_notification_schema_has_correct_status(sample_notification, schema_name [ ("name", "New User"), ("email_address", "newuser@mail.com"), - ("mobile_number", "+4407700900460"), + ("mobile_number", "+14254147755"), ], ) def test_user_update_schema_accepts_valid_attribute_pairs(user_attribute, user_value): diff --git a/tests/app/user/test_rest.py b/tests/app/user/test_rest.py index 8ba087dcc..a388d264e 100644 --- a/tests/app/user/test_rest.py +++ b/tests/app/user/test_rest.py @@ -237,7 +237,7 @@ def test_cannot_create_user_with_empty_strings(admin_request, notify_db_session) [ ("name", "New User"), ("email_address", "newuser@mail.com"), - ("mobile_number", "+4407700900460"), + ("mobile_number", "+14254147755"), ], ) def test_post_user_attribute(admin_request, sample_user, user_attribute, user_value): @@ -273,13 +273,13 @@ def test_post_user_attribute(admin_request, sample_user, user_attribute, user_va ), ( "mobile_number", - "+4407700900460", + "+14254147755", dict( api_key_id=None, key_type=KeyType.NORMAL, notification_type=NotificationType.SMS, personalisation={}, - recipient="+4407700900460", + recipient="+14254147755", reply_to_text="testing", service=mock.ANY, template_id=uuid.UUID("8a31520f-4751-4789-8ea1-fe54496725eb"), @@ -315,6 +315,7 @@ def test_post_user_attribute_with_updated_by( mock_persist_notification.assert_not_called() +@pytest.mark.skip("We don't support international at the moment") def test_post_user_attribute_with_updated_by_sends_notification_to_international_from_number( admin_request, mocker, sample_user, team_member_mobile_edit_template ): diff --git a/tests/app/user/test_rest_verify.py b/tests/app/user/test_rest_verify.py index 21182972d..26eb085a4 100644 --- a/tests/app/user/test_rest_verify.py +++ b/tests/app/user/test_rest_verify.py @@ -245,7 +245,7 @@ def test_send_user_code_for_sms_with_optional_to_field( mock_redis_get.return_value = "foo" mocker.patch("app.user.rest.redis_store.raw_set") - to_number = "+447119876757" + to_number = "+14254147755" mocked = mocker.patch("app.user.rest.create_secret_code", return_value="11111") mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") auth_header = create_admin_authorization_header() @@ -581,6 +581,7 @@ def test_user_verify_email_code_fails_if_code_already_used( assert sample_user.current_session_id is None +@pytest.mark.skip("We don't support international at the moment") def test_send_user_2fa_code_sends_from_number_for_international_numbers( client, sample_user, mocker, sms_code_template ): diff --git a/tests/app/v2/notifications/test_post_notifications.py b/tests/app/v2/notifications/test_post_notifications.py index e9399808d..13cb579e3 100644 --- a/tests/app/v2/notifications/test_post_notifications.py +++ b/tests/app/v2/notifications/test_post_notifications.py @@ -41,7 +41,7 @@ def test_post_sms_notification_returns_201( ): mocked = mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") data = { - "phone_number": "+447700900855", + "phone_number": "+12028675309", "template_id": str(sample_template_with_placeholders.id), "personalisation": {" Name": "Jo"}, } @@ -92,7 +92,7 @@ def test_post_sms_notification_uses_inbound_number_as_sender( ) mocked = mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") data = { - "phone_number": "+447700900855", + "phone_number": "+12028675309", "template_id": str(template.id), "personalisation": {" Name": "Jo"}, } @@ -125,7 +125,7 @@ def test_post_sms_notification_uses_inbound_number_reply_to_as_sender( ) mocked = mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") data = { - "phone_number": "+447700900855", + "phone_number": "+12028675309", "template_id": str(template.id), "personalisation": {" Name": "Jo"}, } @@ -156,7 +156,7 @@ def test_post_sms_notification_returns_201_with_sms_sender_id( ) mocked = mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") data = { - "phone_number": "+447700900855", + "phone_number": "+12028675309", "template_id": str(sample_template_with_placeholders.id), "personalisation": {" Name": "Jo"}, "sms_sender_id": str(sms_sender.id), @@ -188,7 +188,7 @@ def test_post_sms_notification_uses_sms_sender_id_reply_to( ) mocked = mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") data = { - "phone_number": "+447700900855", + "phone_number": "+12028675309", "template_id": str(sample_template_with_placeholders.id), "personalisation": {" Name": "Jo"}, "sms_sender_id": str(sms_sender.id), @@ -294,7 +294,7 @@ def test_should_cache_template_and_service_in_redis(mocker, client, sample_templ mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") data = { - "phone_number": "+447700900855", + "phone_number": "+12028675309", "template_id": str(sample_template.id), } @@ -373,7 +373,7 @@ def test_should_return_template_if_found_in_redis(mocker, client, sample_templat @pytest.mark.parametrize( "notification_type, key_send_to, send_to", [ - (NotificationType.SMS, "phone_number", "+447700900855"), + (NotificationType.SMS, "phone_number", "+12028675309"), (NotificationType.EMAIL, "email_address", "sample@email.com"), ], ) @@ -402,7 +402,7 @@ def test_post_notification_returns_400_and_missing_template( @pytest.mark.parametrize( "notification_type, key_send_to, send_to", [ - (NotificationType.SMS, "phone_number", "+447700900855"), + (NotificationType.SMS, "phone_number", "+12028675309"), (NotificationType.EMAIL, "email_address", "sample@email.com"), ], ) @@ -432,7 +432,7 @@ def test_post_notification_returns_401_and_well_formed_auth_error( @pytest.mark.parametrize( "notification_type, key_send_to, send_to", [ - (NotificationType.SMS, "phone_number", "+447700900855"), + (NotificationType.SMS, "phone_number", "+12028675309"), (NotificationType.EMAIL, "email_address", "sample@email.com"), ], ) @@ -529,7 +529,6 @@ def test_post_email_notification_returns_201( ("simulate-delivered-2@notifications.service.gov.uk", NotificationType.EMAIL), ("simulate-delivered-3@notifications.service.gov.uk", NotificationType.EMAIL), ("+14254147167", NotificationType.SMS), - ("+14254147755", NotificationType.SMS), ], ) def test_should_not_persist_or_send_notification_if_simulated_recipient( @@ -652,6 +651,7 @@ def test_returns_a_429_limit_exceeded_if_rate_limit_exceeded( assert not deliver_mock.called +@pytest.mark.skip("We don't support international at the moment") def test_post_sms_notification_returns_400_if_not_allowed_to_send_int_sms( client, notify_db_session, @@ -689,7 +689,7 @@ def test_post_sms_notification_with_archived_reply_to_id_returns_400( ) mocker.patch("app.celery.provider_tasks.deliver_email.apply_async") data = { - "phone_number": "+447700900855", + "phone_number": "+12028675309", "template_id": sample_template.id, "sms_sender_id": archived_sender.id, } @@ -781,7 +781,7 @@ def test_post_sms_notification_returns_400_if_number_not_in_guest_list( create_api_key(service=service, key_type=KeyType.TEAM) data = { - "phone_number": "+327700900855", + "phone_number": "+16615555555", "template_id": template.id, } auth_header = create_service_authorization_header( @@ -806,6 +806,7 @@ def test_post_sms_notification_returns_400_if_number_not_in_guest_list( ] +@pytest.mark.skip("We don't support international at the moment") def test_post_sms_notification_returns_201_if_allowed_to_send_int_sms( sample_service, sample_template, @@ -832,7 +833,7 @@ def test_post_sms_should_persist_supplied_sms_number( ): mocked = mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") data = { - "phone_number": "+(44) 77009-00855", + "phone_number": "+16615555555", "template_id": str(sample_template_with_placeholders.id), "personalisation": {" Name": "Jo"}, } @@ -888,7 +889,7 @@ def test_post_notification_with_wrong_type_of_sender( template = sample_template form_label = "email_reply_to_id" data = { - "phone_number": "+447700900855", + "phone_number": "+12028675309", "template_id": str(template.id), form_label: fake_uuid, } @@ -1204,7 +1205,7 @@ def test_post_notification_returns_201_when_content_type_is_missing_but_payload_ if notification_type == NotificationType.EMAIL: valid_json.update({"email_address": sample_service.users[0].email_address}) else: - valid_json.update({"phone_number": "+447700900855"}) + valid_json.update({"phone_number": "+12028675309"}) response = client.post( path=f"/v2/notifications/{notification_type}", data=json.dumps(valid_json), @@ -1274,7 +1275,7 @@ def test_post_notifications_saves_email_or_sms_to_queue( ( data.update({"email_address": "joe.citizen@example.com"}) if notification_type == NotificationType.EMAIL - else data.update({"phone_number": "+447700900855"}) + else data.update({"phone_number": "+12028675309"}) ) response = client.post( @@ -1343,7 +1344,7 @@ def test_post_notifications_saves_email_or_sms_normally_if_saving_to_queue_fails ( data.update({"email_address": "joe.citizen@example.com"}) if notification_type == NotificationType.EMAIL - else data.update({"phone_number": "+447700900855"}) + else data.update({"phone_number": "+12028675309"}) ) response = client.post( @@ -1405,7 +1406,7 @@ def test_post_notifications_doesnt_use_save_queue_for_test_notifications( ( data.update({"email_address": "joe.citizen@example.com"}) if notification_type == NotificationType.EMAIL - else data.update({"phone_number": "+447700900855"}) + else data.update({"phone_number": "+12028675309"}) ) response = client.post( path=f"/v2/notifications/{notification_type}",