diff --git a/app/models/template_list.py b/app/models/template_list.py index be8e4e121..d3b1ee2b6 100644 --- a/app/models/template_list.py +++ b/app/models/template_list.py @@ -24,10 +24,10 @@ class TemplateList(): yield TemplateListFolder( item, folders=self.service.get_template_folders( - self.template_type, item['id'] + template_type, item['id'] ), templates=self.service.get_templates( - self.template_type, item['id'] + template_type, item['id'] ), ancestors=ancestors, service_id=self.service.id, @@ -38,7 +38,7 @@ class TemplateList(): yield sub_item for item in self.service.get_templates( - self.template_type, template_folder_id + template_type, template_folder_id ): yield TemplateListTemplate( item, diff --git a/tests/app/main/views/test_template_folders.py b/tests/app/main/views/test_template_folders.py index 9bd254037..5fb8011b6 100644 --- a/tests/app/main/views/test_template_folders.py +++ b/tests/app/main/views/test_template_folders.py @@ -302,6 +302,24 @@ def test_post_add_template_folder_page(client_request, service_one, mocker, pare ], None, ), + ( + 'folder_one_one_one – folder_one_one – folder_one – Templates – service one – GOV.UK Notify', + 'Templates / folder_one / folder_one_one / folder_one_one_one', + [ + {'template_type': 'email'}, + {'template_type': 'email', 'template_folder_id': PARENT_FOLDER_ID}, + {'template_type': 'email', 'template_folder_id': CHILD_FOLDER_ID}, + ], + { + 'template_type': 'email', + 'template_folder_id': GRANDCHILD_FOLDER_ID, + }, + ['All', 'Text message', 'Letter'], + [], + [], + [], + 'There are no email templates in this folder', + ), ( 'folder_two – Templates – service one – GOV.UK Notify', 'Templates / folder_two',