mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 23:08:07 -04:00
Reuse TemplateList class when deleting a folder
Part of moving "get_template_folders" et al. into TemplateList so we can cache it more effectively. This is slightly less efficient as iterating a TemplateList will instantiate an object for each item in the folder; but the difference is minimal. Note that: - The default template_type for TemplateList is "all". - We need to pass realistic template "JSON" in the test now.
This commit is contained in:
@@ -5,7 +5,7 @@ from flask import abort, url_for
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
from app.models.user import User
|
||||
from tests import sample_uuid
|
||||
from tests import sample_uuid, template_json
|
||||
from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
TEMPLATE_ONE_ID,
|
||||
@@ -968,7 +968,7 @@ def test_delete_template_folder_should_detect_non_empty_folder_on_get(
|
||||
]
|
||||
mocker.patch(
|
||||
'app.models.service.Service.get_templates',
|
||||
return_value=[{'id': template_id, 'name': 'template'}],
|
||||
return_value=[template_json(service_one['id'], template_id)],
|
||||
)
|
||||
client_request.get(
|
||||
'main.delete_template_folder', service_id=service_one['id'],
|
||||
|
||||
Reference in New Issue
Block a user