mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Save normalized phone format to DB
This commit is contained in:
@@ -842,15 +842,16 @@ def test_should_not_send_notification_to_non_guest_list_recipient_in_trial_mode(
|
||||
@pytest.mark.parametrize('key_type', [
|
||||
KEY_TYPE_NORMAL, KEY_TYPE_TEAM
|
||||
])
|
||||
@pytest.mark.parametrize('notification_type, to', [
|
||||
(SMS_TYPE, '2028675300'),
|
||||
(EMAIL_TYPE, 'guest_list_recipient@mail.com')]
|
||||
@pytest.mark.parametrize('notification_type, to, normalized_to', [
|
||||
(SMS_TYPE, '2028675300', '+12028675300'),
|
||||
(EMAIL_TYPE, 'guest_list_recipient@mail.com', None)]
|
||||
)
|
||||
def test_should_send_notification_to_guest_list_recipient(
|
||||
client,
|
||||
sample_service,
|
||||
notification_type,
|
||||
to,
|
||||
normalized_to,
|
||||
key_type,
|
||||
service_restricted,
|
||||
mocker
|
||||
@@ -866,7 +867,7 @@ def test_should_send_notification_to_guest_list_recipient(
|
||||
service_guest_list = create_service_guest_list(sample_service, email_address=to)
|
||||
|
||||
assert service_guest_list.service_id == sample_service.id
|
||||
assert to in [member.recipient for member in sample_service.guest_list]
|
||||
assert (normalized_to or to) in [member.recipient for member in sample_service.guest_list]
|
||||
|
||||
create_notification(template=template)
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ def test_get_guest_list_separates_emails_and_phones(client, sample_service):
|
||||
assert response.status_code == 200
|
||||
json_resp = json.loads(response.get_data(as_text=True))
|
||||
assert json_resp['email_addresses'] == ['service@example.com']
|
||||
assert sorted(json_resp['phone_numbers']) == sorted(['+1800-555-5555', '2028675309'])
|
||||
assert sorted(json_resp['phone_numbers']) == sorted(['+18005555555', '+12028675309'])
|
||||
|
||||
|
||||
def test_get_guest_list_404s_with_unknown_service_id(client):
|
||||
@@ -69,7 +69,7 @@ def test_update_guest_list_replaces_old_guest_list(client, sample_service_guest_
|
||||
assert response.status_code == 204
|
||||
guest_list = ServiceGuestList.query.order_by(ServiceGuestList.recipient).all()
|
||||
assert len(guest_list) == 2
|
||||
assert guest_list[0].recipient == '2028765309'
|
||||
assert guest_list[0].recipient == '+12028765309'
|
||||
assert guest_list[1].recipient == 'foo@bar.com'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user