From 543bff1c3045bc21fced0fe1f0badee76c6a26a4 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Wed, 12 May 2021 10:45:51 +0100 Subject: [PATCH] bump utils to fix sending to international numbers via allowlist --- tests/app/notifications/test_validators.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/app/notifications/test_validators.py b/tests/app/notifications/test_validators.py index 6f58b5856..d09f90091 100644 --- a/tests/app/notifications/test_validators.py +++ b/tests/app/notifications/test_validators.py @@ -166,6 +166,29 @@ def test_service_can_send_to_recipient_passes(key_type, notify_db_session): serialised_service) is None +@pytest.mark.parametrize('user_number, recipient_number', [ + ['0048601234567', '+486 012 34567'], + ['07513332413', '(07513) 332413'], +]) +def test_service_can_send_to_recipient_passes_with_non_normalised_number(sample_service, user_number, recipient_number): + sample_service.users[0].mobile_number = user_number + + serialised_service = SerialisedService.from_id(sample_service.id) + + assert service_can_send_to_recipient(recipient_number, 'team', serialised_service) is None + + +@pytest.mark.parametrize('user_email, recipient_email', [ + ['test@example.com', 'TeSt@EXAMPLE.com'], +]) +def test_service_can_send_to_recipient_passes_with_non_normalised_email(sample_service, user_email, recipient_email): + sample_service.users[0].email_address = user_email + + serialised_service = SerialisedService.from_id(sample_service.id) + + assert service_can_send_to_recipient(recipient_email, 'team', serialised_service) is None + + @pytest.mark.parametrize('key_type', ['test', 'normal']) def test_service_can_send_to_recipient_passes_for_live_service_non_team_member(key_type, sample_service):