diff --git a/requirements.in b/requirements.in index 9cff0c2c6d..b70d8ede8e 100644 --- a/requirements.in +++ b/requirements.in @@ -24,7 +24,7 @@ lxml==4.9.3 notifications-python-client==8.0.1 # Run `make bump-utils` to update to the latest version -notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@82.2.1 +notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@82.4.0 # gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains prometheus-client==0.14.1 diff --git a/requirements.txt b/requirements.txt index 1072fc1f22..ee599d5bce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -151,7 +151,7 @@ mistune==0.8.4 # via notifications-utils notifications-python-client==8.0.1 # via -r requirements.in -notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@82.2.1 +notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@82.4.0 # via -r requirements.in ordered-set==4.1.0 # via notifications-utils diff --git a/tests/app/notifications/test_process_notification.py b/tests/app/notifications/test_process_notification.py index 5fb4658f85..00ffd233f0 100644 --- a/tests/app/notifications/test_process_notification.py +++ b/tests/app/notifications/test_process_notification.py @@ -452,6 +452,41 @@ def test_persist_notification_without_send_to_landline_raises_invalidphoneerror( ) +@pytest.mark.parametrize( + "recipient", + [ + "0845 46 46", # short premium + "0900 123 4567", # premium + ], +) +def test_persist_notification_with_send_to_landline_to_premium_number_raises_invallidphoneerror( + sample_job, + sample_api_key, + mocker, + recipient, +): + sample_job.service.permissions = [ + # and any other permissions we need + ServicePermission(service_id=sample_job.service.id, permission=SMS_TYPE), + ServicePermission(service_id=sample_job.service.id, permission=SMS_TO_UK_LANDLINES), + ] + with pytest.raises(InvalidPhoneError) as exc: + persist_notification( + template_id=sample_job.template.id, + template_version=sample_job.template.version, + recipient=recipient, + service=sample_job.service, + personalisation=None, + notification_type="sms", + api_key_id=sample_api_key.id, + key_type=sample_api_key.key_type, + job_id=sample_job.id, + job_row_number=10, + client_reference="ref from client", + ) + assert exc.value.code == InvalidPhoneError.Codes.INVALID_NUMBER + + def test_persist_notification_with_international_info_does_not_store_for_email(sample_job, sample_api_key, mocker): persist_notification(