mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Make international SMS on for new services
International SMS is a mature, documented feature now. There’s no reason it shouldn’t be available to everyone. If it’s turned off by default then we’re relying on people finding it in the settings page to know that it exists (which we found in research the other week that users, who would have benefitted from having international SMS, were failing to do). This also fixes the problem whereby users signing up for Notify with an international phone number (eg those working abroad for the Foreign and Commonwealth Office) couldn’t get through the tour because they weren’t able to send themselves the example text message (see https://www.pivotaltracker.com/story/show/150705515).
This commit is contained in:
@@ -328,17 +328,26 @@ def test_returns_a_429_limit_exceeded_if_rate_limit_exceeded(
|
||||
assert not deliver_mock.called
|
||||
|
||||
|
||||
def test_post_sms_notification_returns_400_if_not_allowed_to_send_int_sms(client, sample_service, sample_template):
|
||||
def test_post_sms_notification_returns_400_if_not_allowed_to_send_int_sms(
|
||||
client,
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
):
|
||||
|
||||
service = sample_service(notify_db, notify_db_session, permissions=[SMS_TYPE])
|
||||
template = create_sample_template(notify_db, notify_db_session, service=service)
|
||||
|
||||
data = {
|
||||
'phone_number': '20-12-1234-1234',
|
||||
'template_id': sample_template.id
|
||||
'template_id': template.id
|
||||
}
|
||||
auth_header = create_authorization_header(service_id=sample_service.id)
|
||||
auth_header = create_authorization_header(service_id=service.id)
|
||||
|
||||
response = client.post(
|
||||
path='/v2/notifications/sms',
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), auth_header])
|
||||
headers=[('Content-Type', 'application/json'), auth_header]
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.headers['Content-type'] == 'application/json'
|
||||
@@ -378,18 +387,20 @@ def test_post_sms_notification_returns_400_if_not_allowed_to_send_notification(
|
||||
]
|
||||
|
||||
|
||||
def test_post_sms_notification_returns_201_if_allowed_to_send_int_sms(notify_db, notify_db_session, client, mocker):
|
||||
|
||||
service = sample_service(notify_db, notify_db_session, permissions=[SMS_TYPE, INTERNATIONAL_SMS_TYPE])
|
||||
template = create_sample_template(notify_db, notify_db_session, service=service)
|
||||
def test_post_sms_notification_returns_201_if_allowed_to_send_int_sms(
|
||||
sample_service,
|
||||
sample_template,
|
||||
client,
|
||||
mocker,
|
||||
):
|
||||
|
||||
mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
|
||||
|
||||
data = {
|
||||
'phone_number': '20-12-1234-1234',
|
||||
'template_id': template.id
|
||||
'template_id': sample_template.id
|
||||
}
|
||||
auth_header = create_authorization_header(service_id=service.id)
|
||||
auth_header = create_authorization_header(service_id=sample_service.id)
|
||||
|
||||
response = client.post(
|
||||
path='/v2/notifications/sms',
|
||||
|
||||
Reference in New Issue
Block a user