mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
Was incorrectly setting from not reply to
This commit is contained in:
@@ -250,6 +250,7 @@ def test_should_process_email_job_if_exactly_on_send_limits(notify_db,
|
||||
"something_encrypted",
|
||||
"2016-01-01T11:09:00.061258"
|
||||
),
|
||||
{'reply_to_addresses': None},
|
||||
queue="bulk-email"
|
||||
)
|
||||
mock_celery_remove_job.assert_called_once_with((str(job.id),), queue="remove-job")
|
||||
@@ -299,6 +300,7 @@ def test_should_process_email_job(sample_email_job, mocker, mock_celery_remove_j
|
||||
"something_encrypted",
|
||||
"2016-01-01T11:09:00.061258"
|
||||
),
|
||||
{'reply_to_addresses': None},
|
||||
queue="bulk-email"
|
||||
)
|
||||
job = jobs_dao.dao_get_job_by_id(sample_email_job.id)
|
||||
@@ -527,7 +529,8 @@ def test_should_send_email_if_restricted_service_and_valid_email(notify_db, noti
|
||||
"test@restricted.com",
|
||||
template.subject,
|
||||
body=template.content,
|
||||
html_body=AnyStringWith(template.content)
|
||||
html_body=AnyStringWith(template.content),
|
||||
reply_to_addresses=None
|
||||
)
|
||||
|
||||
|
||||
@@ -618,7 +621,8 @@ def test_should_use_email_template_and_persist(sample_email_template_with_placeh
|
||||
"my_email@my_email.com",
|
||||
notification['personalisation']['name'],
|
||||
body="Hello Jo",
|
||||
html_body=AnyStringWith("Hello Jo")
|
||||
html_body=AnyStringWith("Hello Jo"),
|
||||
reply_to_addresses=None
|
||||
)
|
||||
|
||||
statsd_client.incr.assert_called_once_with("notifications.tasks.send-email")
|
||||
@@ -669,7 +673,8 @@ def test_send_email_should_use_template_version_from_job_not_latest(sample_email
|
||||
"my_email@my_email.com",
|
||||
sample_email_template.subject,
|
||||
body="This is a template",
|
||||
html_body=AnyStringWith("This is a template")
|
||||
html_body=AnyStringWith("This is a template"),
|
||||
reply_to_addresses=None
|
||||
)
|
||||
|
||||
persisted_notification = notifications_dao.get_notification(sample_email_template.service_id, notification_id)
|
||||
@@ -704,7 +709,8 @@ def test_should_use_email_template_subject_placeholders(sample_email_template_wi
|
||||
"my_email@my_email.com",
|
||||
notification['personalisation']['name'],
|
||||
body="Hello Jo",
|
||||
html_body=AnyStringWith("Hello Jo")
|
||||
html_body=AnyStringWith("Hello Jo"),
|
||||
reply_to_addresses=None
|
||||
)
|
||||
persisted_notification = notifications_dao.get_notification(
|
||||
sample_email_template_with_placeholders.service_id, notification_id
|
||||
@@ -758,7 +764,8 @@ def test_should_use_email_template_and_persist_without_personalisation(sample_em
|
||||
"my_email@my_email.com",
|
||||
sample_email_template.subject,
|
||||
body="This is a template",
|
||||
html_body=AnyStringWith("This is a template")
|
||||
html_body=AnyStringWith("This is a template"),
|
||||
reply_to_addresses=None
|
||||
)
|
||||
|
||||
|
||||
@@ -815,7 +822,8 @@ def test_should_persist_notification_as_failed_if_email_client_fails(sample_emai
|
||||
"my_email@my_email.com",
|
||||
sample_email_template.subject,
|
||||
body=sample_email_template.content,
|
||||
html_body=AnyStringWith(sample_email_template.content)
|
||||
html_body=AnyStringWith(sample_email_template.content),
|
||||
reply_to_addresses=None
|
||||
)
|
||||
persisted_notification = notifications_dao.get_notification(sample_email_template.service_id, notification_id)
|
||||
assert persisted_notification.id == notification_id
|
||||
@@ -948,33 +956,7 @@ def test_email_reset_password_should_send_email(notify_db, notify_db_session, no
|
||||
message)
|
||||
|
||||
|
||||
def test_process_email_job_should_use_email_from_if_no_reply_to(sample_email_job, mocker, mock_celery_remove_job):
|
||||
mocker.patch('app.celery.tasks.s3.get_job_from_s3', return_value=load_example_csv('email'))
|
||||
mocker.patch('app.celery.tasks.send_email.apply_async')
|
||||
mocker.patch('app.encryption.encrypt', return_value='something_encrypted')
|
||||
mocker.patch('app.celery.tasks.create_uuid', return_value='uuid')
|
||||
|
||||
sample_email_job.service.reply_to_email_address = None
|
||||
|
||||
process_job(sample_email_job.id)
|
||||
|
||||
tasks.send_email.apply_async.assert_called_once_with(
|
||||
(
|
||||
str(sample_email_job.service_id),
|
||||
'uuid',
|
||||
"\"{}\" <{}@{}>".format(
|
||||
sample_email_job.service.name,
|
||||
sample_email_job.service.email_from,
|
||||
current_app.config['NOTIFY_EMAIL_DOMAIN']
|
||||
),
|
||||
'something_encrypted',
|
||||
ANY
|
||||
),
|
||||
queue="bulk-email"
|
||||
)
|
||||
|
||||
|
||||
def test_process_email_job_should_use_reply_to_email(sample_email_job, mocker, mock_celery_remove_job):
|
||||
def test_process_email_job_should_use_reply_to_email_if_present(sample_email_job, mocker, mock_celery_remove_job):
|
||||
mocker.patch('app.celery.tasks.s3.get_job_from_s3', return_value=load_example_csv('email'))
|
||||
mocker.patch('app.celery.tasks.send_email.apply_async')
|
||||
mocker.patch('app.encryption.encrypt', return_value='something_encrypted')
|
||||
@@ -987,11 +969,16 @@ def test_process_email_job_should_use_reply_to_email(sample_email_job, mocker, m
|
||||
tasks.send_email.apply_async.assert_called_once_with(
|
||||
(
|
||||
str(sample_email_job.service_id),
|
||||
'uuid',
|
||||
'somereply@testservice.gov.uk',
|
||||
'something_encrypted',
|
||||
"uuid",
|
||||
"\"{}\" <{}@{}>".format(
|
||||
sample_email_job.service.name,
|
||||
sample_email_job.service.email_from,
|
||||
"test.notify.com"
|
||||
),
|
||||
"something_encrypted",
|
||||
ANY
|
||||
),
|
||||
{'reply_to_addresses': 'somereply@testservice.gov.uk'},
|
||||
queue="bulk-email"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user