Update tests to focus on US numbers

This commit is contained in:
Ryan Ahearn
2023-01-04 16:35:25 -05:00
parent abc7b09d0d
commit 82df01653f
21 changed files with 172 additions and 201 deletions

View File

@@ -31,11 +31,11 @@ def test_make_sns_callback(notify_api, rmock):
endpoint,
json={"status": "success"},
status_code=200)
send_sms_response("sns", "1234", "5558675309")
send_sms_response("sns", "1234", "2028675309")
assert rmock.called
assert rmock.request_history[0].url == endpoint
assert json.loads(rmock.request_history[0].text)['MSISDN'] == '5558675309'
assert json.loads(rmock.request_history[0].text)['MSISDN'] == '2028675309'
@pytest.mark.skip(reason="Re-enable when SMS receipts exist")
@@ -70,7 +70,7 @@ def test_make_ses_callback(notify_api, mocker):
@pytest.mark.skip(reason="Re-enable when SNS delivery receipts exist")
def test_delievered_sns_callback():
phone_number = "5558675309"
phone_number = "2028675309"
data = json.loads(sns_callback("1234", phone_number))
assert data['MSISDN'] == phone_number
assert data['status'] == "3"
@@ -80,7 +80,7 @@ def test_delievered_sns_callback():
@pytest.mark.skip(reason="Re-enable when SNS delivery receipts exist")
def test_perm_failure_sns_callback():
phone_number = "5558675302"
phone_number = "2028675302"
data = json.loads(sns_callback("1234", phone_number))
assert data['MSISDN'] == phone_number
assert data['status'] == "5"
@@ -90,7 +90,7 @@ def test_perm_failure_sns_callback():
@pytest.mark.skip(reason="Re-enable when SNS delivery receipts exist")
def test_temp_failure_sns_callback():
phone_number = "5558675303"
phone_number = "2028675303"
data = json.loads(sns_callback("1234", phone_number))
assert data['MSISDN'] == phone_number
assert data['status'] == "4"

View File

@@ -502,10 +502,10 @@ def test_should_put_save_sms_task_in_research_mode_queue_if_research_mode_servic
def test_should_save_sms_if_restricted_service_and_valid_number(notify_db_session, mocker):
user = create_user(mobile_number="07700 900890")
user = create_user(mobile_number="202-867-5309")
service = create_service(user=user, restricted=True)
template = create_template(service=service)
notification = _notification_json(template, "+447700900890") # The users own number, but in a different format
notification = _notification_json(template, "+12028675309") # The users own number, but in a different format
mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
@@ -518,7 +518,7 @@ def test_should_save_sms_if_restricted_service_and_valid_number(notify_db_sessio
)
persisted_notification = Notification.query.one()
assert persisted_notification.to == '+447700900890'
assert persisted_notification.to == '+12028675309'
assert persisted_notification.template_id == template.id
assert persisted_notification.template_version == template.version
assert persisted_notification.status == 'created'
@@ -553,11 +553,11 @@ def test_save_email_should_save_default_email_reply_to_text_on_notification(noti
assert persisted_notification.reply_to_text == 'reply_to@digital.gov.uk'
def test_save_sms_should_save_default_smm_sender_notification_reply_to_text_on(notify_db_session, mocker):
def test_save_sms_should_save_default_sms_sender_notification_reply_to_text_on(notify_db_session, mocker):
service = create_service_with_defined_sms_sender(sms_sender_value='12345')
template = create_template(service=service)
notification = _notification_json(template, to="07700 900205")
notification = _notification_json(template, to="2028675309")
mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
notification_id = uuid.uuid4()
@@ -1204,10 +1204,10 @@ def test_save_letter_uses_template_reply_to_text(mocker, notify_db_session):
def test_save_sms_uses_sms_sender_reply_to_text(mocker, notify_db_session):
service = create_service_with_defined_sms_sender(sms_sender_value='07123123123')
service = create_service_with_defined_sms_sender(sms_sender_value='2028675309')
template = create_template(service=service)
notification = _notification_json(template, to="07700 900205")
notification = _notification_json(template, to="2028675301")
mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
notification_id = uuid.uuid4()
@@ -1218,15 +1218,15 @@ def test_save_sms_uses_sms_sender_reply_to_text(mocker, notify_db_session):
)
persisted_notification = Notification.query.one()
assert persisted_notification.reply_to_text == '447123123123'
assert persisted_notification.reply_to_text == '+12028675309'
def test_save_sms_uses_non_default_sms_sender_reply_to_text_if_provided(mocker, notify_db_session):
service = create_service_with_defined_sms_sender(sms_sender_value='07123123123')
service = create_service_with_defined_sms_sender(sms_sender_value='2028675309')
template = create_template(service=service)
new_sender = service_sms_sender_dao.dao_add_sms_sender_for_service(service.id, 'new-sender', False)
notification = _notification_json(template, to="07700 900205")
notification = _notification_json(template, to="202-867-5301")
mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
notification_id = uuid.uuid4()
@@ -1918,7 +1918,7 @@ def test_save_api_email_dont_retry_if_notification_already_exists(sample_service
), (
save_sms,
'app.celery.provider_tasks.deliver_sms.apply_async',
'07700 900890',
'202-867-5309',
{'template_type': 'sms'}
),
))