mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Refactor send_email_to_provider
- Remove debug statement
This commit is contained in:
@@ -90,9 +90,7 @@ def send_email_to_provider(notification):
|
|||||||
return
|
return
|
||||||
if notification.status == 'created':
|
if notification.status == 'created':
|
||||||
provider = provider_to_use(EMAIL_TYPE, notification.id)
|
provider = provider_to_use(EMAIL_TYPE, notification.id)
|
||||||
current_app.logger.debug(
|
|
||||||
"Starting sending EMAIL {} to provider at {}".format(notification.id, datetime.utcnow())
|
|
||||||
)
|
|
||||||
template_dict = dao_get_template_by_id(notification.template_id, notification.template_version).__dict__
|
template_dict = dao_get_template_by_id(notification.template_id, notification.template_version).__dict__
|
||||||
|
|
||||||
html_email = HTMLEmailTemplate(
|
html_email = HTMLEmailTemplate(
|
||||||
@@ -107,11 +105,9 @@ def send_email_to_provider(notification):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if service.research_mode or notification.key_type == KEY_TYPE_TEST:
|
if service.research_mode or notification.key_type == KEY_TYPE_TEST:
|
||||||
reference = str(create_uuid())
|
notification.reference = str(create_uuid())
|
||||||
notification.billable_units = 0
|
|
||||||
notification.reference = reference
|
|
||||||
update_notification_to_sending(notification, provider)
|
update_notification_to_sending(notification, provider)
|
||||||
send_email_response(reference, notification.to)
|
send_email_response(notification.reference, notification.to)
|
||||||
else:
|
else:
|
||||||
from_address = '"{}" <{}@{}>'.format(service.name, service.email_from,
|
from_address = '"{}" <{}@{}>'.format(service.name, service.email_from,
|
||||||
current_app.config['NOTIFY_EMAIL_DOMAIN'])
|
current_app.config['NOTIFY_EMAIL_DOMAIN'])
|
||||||
|
|||||||
@@ -319,7 +319,8 @@ def test_send_email_to_provider_should_call_research_mode_task_response_task_if_
|
|||||||
notification = create_notification(
|
notification = create_notification(
|
||||||
template=sample_email_template,
|
template=sample_email_template,
|
||||||
to_field="john@smith.com",
|
to_field="john@smith.com",
|
||||||
key_type=key_type
|
key_type=key_type,
|
||||||
|
billable_units=0
|
||||||
)
|
)
|
||||||
sample_service.research_mode = research_mode
|
sample_service.research_mode = research_mode
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user