mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Changes after review. Updates to style and import order to be more consistent with other code.
Added clarification to an error message to give better debugging information. Removed using dao_get_reply_to_by_service_id in tests to be more consistent with other code and use the test db functions or remove the need for a call altogether making the code less complex.
This commit is contained in:
@@ -40,7 +40,9 @@ from app.models import (
|
||||
KEY_TYPE_NORMAL, KEY_TYPE_TEST,
|
||||
LETTER_TYPE,
|
||||
NOTIFICATION_SENT,
|
||||
NotificationEmailReplyTo, ServiceEmailReplyTo)
|
||||
NotificationEmailReplyTo,
|
||||
ServiceEmailReplyTo
|
||||
)
|
||||
|
||||
from app.dao.dao_utils import transactional
|
||||
from app.statsd_decorators import statsd
|
||||
@@ -619,7 +621,7 @@ def dao_get_notification_email_reply_for_notification(notification_id):
|
||||
NotificationEmailReplyTo
|
||||
).filter(
|
||||
NotificationEmailReplyTo.notification_id == notification_id
|
||||
).all()
|
||||
).first()
|
||||
|
||||
if len(email_reply_to) == 1:
|
||||
return email_reply_to[0].email_address
|
||||
if email_reply_to:
|
||||
return email_reply_to.email_address
|
||||
|
||||
@@ -140,5 +140,6 @@ def check_service_email_reply_to_id(service_id, reply_to_id):
|
||||
try:
|
||||
reply_to = dao_get_reply_to_by_id(service_id, reply_to_id)
|
||||
except NoResultFound:
|
||||
message = 'email_reply_to_id does not exist in database'
|
||||
message = 'email_reply_to_id {} does not exist in database for service id {}'\
|
||||
.format(reply_to_id, service_id)
|
||||
raise BadRequestError(message=message)
|
||||
|
||||
@@ -19,7 +19,9 @@ from app.notifications.process_notifications import (
|
||||
persist_notification,
|
||||
send_notification_to_queue,
|
||||
simulated_recipient,
|
||||
persist_scheduled_notification, persist_email_reply_to_id_for_notification)
|
||||
persist_scheduled_notification,
|
||||
persist_email_reply_to_id_for_notification
|
||||
)
|
||||
from app.notifications.process_letter_notifications import (
|
||||
create_letter_notification
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user