mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
Fixed unit test
This commit is contained in:
@@ -60,16 +60,12 @@ def get_notification_by_id(notification_id):
|
|||||||
template_dict, notification.personalisation or {}
|
template_dict, notification.personalisation or {}
|
||||||
)
|
)
|
||||||
notification.body = template.content_with_placeholders_filled_in
|
notification.body = template.content_with_placeholders_filled_in
|
||||||
if hasattr(template, "subject") and hasattr(notification, "subject"):
|
|
||||||
notification.subject = template.subject
|
|
||||||
try:
|
|
||||||
notification.subject = template.subject
|
|
||||||
except Exception:
|
|
||||||
# Subject attribute may not exist on notification model
|
|
||||||
pass
|
|
||||||
|
|
||||||
schema = PublicNotificationResponseSchema()
|
schema = PublicNotificationResponseSchema()
|
||||||
schema.context = {"notification_instance": notification}
|
schema.context = {
|
||||||
|
"notification_instance": notification,
|
||||||
|
"template_subject": getattr(template, "subject", None) if hasattr(template, "subject") else None
|
||||||
|
}
|
||||||
serialized = schema.dump(notification)
|
serialized = schema.dump(notification)
|
||||||
|
|
||||||
return jsonify(data={"notification": serialized}), 200
|
return jsonify(data={"notification": serialized}), 200
|
||||||
|
|||||||
Reference in New Issue
Block a user