Refactor send_email_to_provider

- Remove debug statement
This commit is contained in:
Rebecca Law
2019-05-08 15:55:45 +01:00
parent 53f0e9334a
commit 77c35da5ca
2 changed files with 5 additions and 8 deletions

View File

@@ -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'])

View File

@@ -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