mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
Stop populating the notification to sender mapping table when creating a notificaiton.
This commit is contained in:
@@ -29,7 +29,6 @@ from tests.app.db import (
|
||||
create_template,
|
||||
create_notification,
|
||||
create_reply_to_email,
|
||||
create_reply_to_email_for_notification,
|
||||
create_service_sms_sender,
|
||||
create_service_with_inbound_number,
|
||||
create_service_with_defined_sms_sender
|
||||
@@ -708,65 +707,13 @@ def test_should_handle_sms_sender_and_prefix_message(
|
||||
)
|
||||
|
||||
|
||||
def test_should_use_inbound_number_as_sender_if_default_sms_sender(
|
||||
notify_db_session,
|
||||
mocker
|
||||
):
|
||||
service = create_service_with_inbound_number(inbound_number='inbound')
|
||||
create_service_sms_sender(service=service, sms_sender="sms_sender", is_default=False)
|
||||
template = create_template(service, content='bar')
|
||||
notification = create_notification(template, reply_to_text='inbound')
|
||||
|
||||
mocker.patch('app.mmg_client.send_sms')
|
||||
mocker.patch('app.delivery.send_to_providers.create_initial_notification_statistic_tasks')
|
||||
|
||||
send_to_providers.send_sms_to_provider(notification)
|
||||
|
||||
mmg_client.send_sms.assert_called_once_with(
|
||||
to=ANY,
|
||||
content=ANY,
|
||||
reference=str(notification.id),
|
||||
sender='inbound'
|
||||
)
|
||||
|
||||
|
||||
def test_should_use_default_sms_sender(
|
||||
notify_db_session,
|
||||
mocker
|
||||
):
|
||||
service = create_service_with_defined_sms_sender(sms_sender_value="test sender")
|
||||
template = create_template(service, content='bar')
|
||||
notification = create_notification(template, reply_to_text=service.get_default_sms_sender())
|
||||
|
||||
mocker.patch('app.mmg_client.send_sms')
|
||||
mocker.patch('app.delivery.send_to_providers.create_initial_notification_statistic_tasks')
|
||||
|
||||
send_to_providers.send_sms_to_provider(notification)
|
||||
|
||||
mmg_client.send_sms.assert_called_once_with(
|
||||
to=ANY,
|
||||
content=ANY,
|
||||
reference=str(notification.id),
|
||||
sender='test sender'
|
||||
)
|
||||
|
||||
|
||||
def test_send_email_to_provider_get_linked_email_reply_to_default_is_false(
|
||||
sample_service,
|
||||
def test_send_email_to_provider_uses_reply_to_from_notification(
|
||||
sample_email_template,
|
||||
mocker):
|
||||
mocker.patch('app.aws_ses_client.send_email', return_value='reference')
|
||||
mocker.patch('app.delivery.send_to_providers.create_initial_notification_statistic_tasks')
|
||||
|
||||
db_notification = create_notification(template=sample_email_template, reply_to_text="test@test.com")
|
||||
create_reply_to_email(service=sample_service, email_address="test@test.com")
|
||||
|
||||
reply_to = create_reply_to_email_for_notification(
|
||||
db_notification.id,
|
||||
sample_service,
|
||||
"test@test.com",
|
||||
is_default=False
|
||||
)
|
||||
|
||||
send_to_providers.send_email_to_provider(
|
||||
db_notification,
|
||||
@@ -778,45 +725,11 @@ def test_send_email_to_provider_get_linked_email_reply_to_default_is_false(
|
||||
ANY,
|
||||
body=ANY,
|
||||
html_body=ANY,
|
||||
reply_to_address=reply_to.email_address
|
||||
)
|
||||
|
||||
|
||||
def test_send_email_to_provider_get_linked_email_reply_to_create_service_email_after_notification_mapping(
|
||||
sample_service,
|
||||
sample_email_template,
|
||||
mocker):
|
||||
mocker.patch('app.aws_ses_client.send_email', return_value='reference')
|
||||
mocker.patch('app.delivery.send_to_providers.create_initial_notification_statistic_tasks')
|
||||
|
||||
db_notification = create_notification(template=sample_email_template,
|
||||
reply_to_text="test@test.com")
|
||||
|
||||
# notification_to_email_reply_to is being deprecated.
|
||||
reply_to = create_reply_to_email_for_notification(
|
||||
db_notification.id,
|
||||
sample_service,
|
||||
"test@test.com"
|
||||
)
|
||||
|
||||
create_reply_to_email(service=sample_service, email_address='foo@bar.com', is_default=False)
|
||||
|
||||
send_to_providers.send_email_to_provider(
|
||||
db_notification,
|
||||
)
|
||||
|
||||
app.aws_ses_client.send_email.assert_called_once_with(
|
||||
ANY,
|
||||
ANY,
|
||||
ANY,
|
||||
body=ANY,
|
||||
html_body=ANY,
|
||||
reply_to_address=reply_to.email_address
|
||||
reply_to_address="test@test.com"
|
||||
)
|
||||
|
||||
|
||||
def test_send_email_to_provider_should_format_reply_to_email_address(
|
||||
sample_service,
|
||||
sample_email_template,
|
||||
mocker):
|
||||
mocker.patch('app.aws_ses_client.send_email', return_value='reference')
|
||||
@@ -824,12 +737,6 @@ def test_send_email_to_provider_should_format_reply_to_email_address(
|
||||
|
||||
db_notification = create_notification(template=sample_email_template, reply_to_text="test@test.com\t")
|
||||
|
||||
reply_to = create_reply_to_email_for_notification(
|
||||
db_notification.id,
|
||||
sample_service,
|
||||
"test@test.com"
|
||||
)
|
||||
|
||||
send_to_providers.send_email_to_provider(
|
||||
db_notification,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user