mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
add tests for redact_template rest
This commit is contained in:
@@ -19,6 +19,7 @@ from app.models import (
|
||||
ApiKey,
|
||||
Template,
|
||||
TemplateHistory,
|
||||
TemplateRedacted,
|
||||
Job,
|
||||
NotificationHistory,
|
||||
Notification,
|
||||
@@ -218,6 +219,7 @@ def delete_service_and_all_associated_db_objects(service):
|
||||
_delete_commit(Job.query.filter_by(service=service))
|
||||
_delete_commit(NotificationHistory.query.filter_by(service=service))
|
||||
_delete_commit(Notification.query.filter_by(service=service))
|
||||
_delete_commit(TemplateRedacted.query.filter_by(service=service))
|
||||
_delete_commit(Template.query.filter_by(service=service))
|
||||
_delete_commit(TemplateHistory.query.filter_by(service_id=service.id))
|
||||
_delete_commit(ServicePermission.query.filter_by(service_id=service.id))
|
||||
|
||||
@@ -61,8 +61,10 @@ def update_template(service_id, template_id):
|
||||
# if redacting, don't update anything else
|
||||
if data.get('redact_personalisation') is True and 'updated_by_id' in data:
|
||||
# we also don't need to check what was passed in redact_personalisation - its presence in the dict is enough.
|
||||
dao_redact_template(fetched_template, data['updated_by_id'])
|
||||
return '', 200
|
||||
# also, only
|
||||
if not fetched_template.redact_personalisation:
|
||||
dao_redact_template(fetched_template, data['updated_by_id'])
|
||||
return 'null', 200
|
||||
|
||||
current_data = dict(template_schema.dump(fetched_template).data.items())
|
||||
updated_template = dict(template_schema.dump(fetched_template).data.items())
|
||||
|
||||
Reference in New Issue
Block a user