mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-06 00:59:41 -04:00
Let the send_email task set the from address
This commit is contained in:
@@ -180,16 +180,10 @@ def process_job(job_id):
|
||||
)
|
||||
|
||||
if template.template_type == 'email':
|
||||
from_email = '"{}" <{}@{}>'.format(
|
||||
service.name,
|
||||
service.email_from,
|
||||
current_app.config['NOTIFY_EMAIL_DOMAIN']
|
||||
)
|
||||
|
||||
send_email.apply_async((
|
||||
str(job.service_id),
|
||||
create_uuid(),
|
||||
from_email.encode('ascii', 'ignore').decode('ascii'),
|
||||
'',
|
||||
encrypted,
|
||||
datetime.utcnow().strftime(DATETIME_FORMAT)),
|
||||
{'reply_to_addresses': service.reply_to_email_address},
|
||||
|
||||
@@ -167,13 +167,10 @@ def send_user_email_verification(user_id):
|
||||
'url': _create_verification_url(user_to_send_to, secret_code)
|
||||
}
|
||||
}
|
||||
email_from = '"GOV.UK Notify" <{}>'.format(
|
||||
current_app.config['VERIFY_CODE_FROM_EMAIL_ADDRESS']
|
||||
)
|
||||
send_email.apply_async((
|
||||
current_app.config['NOTIFY_SERVICE_ID'],
|
||||
str(uuid.uuid4()),
|
||||
email_from,
|
||||
'',
|
||||
encryption.encrypt(message),
|
||||
datetime.utcnow().strftime(DATETIME_FORMAT)
|
||||
), queue='email-registration-verification')
|
||||
|
||||
@@ -248,11 +248,7 @@ def test_should_process_email_job_if_exactly_on_send_limits(notify_db,
|
||||
(
|
||||
str(job.service_id),
|
||||
"uuid",
|
||||
"\"{}\" <{}@{}>".format(
|
||||
service.name,
|
||||
service.email_from,
|
||||
"test.notify.com"
|
||||
),
|
||||
"",
|
||||
"something_encrypted",
|
||||
"2016-01-01T11:09:00.061258"
|
||||
),
|
||||
@@ -298,11 +294,7 @@ def test_should_process_email_job(sample_email_job, mocker, mock_celery_remove_j
|
||||
(
|
||||
str(sample_email_job.service_id),
|
||||
"uuid",
|
||||
"\"{}\" <{}@{}>".format(
|
||||
sample_email_job.service.name,
|
||||
sample_email_job.service.email_from,
|
||||
"test.notify.com"
|
||||
),
|
||||
"",
|
||||
"something_encrypted",
|
||||
"2016-01-01T11:09:00.061258"
|
||||
),
|
||||
@@ -960,11 +952,7 @@ def test_process_email_job_should_use_reply_to_email_if_present(sample_email_job
|
||||
(
|
||||
str(sample_email_job.service_id),
|
||||
"uuid",
|
||||
"\"{}\" <{}@{}>".format(
|
||||
sample_email_job.service.name,
|
||||
sample_email_job.service.email_from,
|
||||
"test.notify.com"
|
||||
),
|
||||
"",
|
||||
"something_encrypted",
|
||||
ANY
|
||||
),
|
||||
|
||||
@@ -331,7 +331,7 @@ def test_send_user_email_verification(notify_api,
|
||||
app.celery.tasks.send_email.apply_async.assert_called_once_with(
|
||||
(str(current_app.config['NOTIFY_SERVICE_ID']),
|
||||
'some_uuid',
|
||||
'"GOV.UK Notify" <{}>'.format(current_app.config['VERIFY_CODE_FROM_EMAIL_ADDRESS']),
|
||||
'',
|
||||
"something_encrypted",
|
||||
"2016-01-01T11:09:00.061258"),
|
||||
queue="email-registration-verification")
|
||||
|
||||
Reference in New Issue
Block a user