From dcd08a0e458d8fe0bcfdf015d06e50fa9d582e61 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Tue, 27 Apr 2021 12:30:50 +0100 Subject: [PATCH] Add unit test for archiving a template with a template folder --- tests/app/template/test_rest.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/app/template/test_rest.py b/tests/app/template/test_rest.py index 79610d09c..759afd215 100644 --- a/tests/app/template/test_rest.py +++ b/tests/app/template/test_rest.py @@ -411,6 +411,27 @@ def test_should_be_able_to_archive_template(client, sample_template): assert Template.query.first().archived +def test_should_be_able_to_archive_template_should_remove_template_folders( + client, sample_service +): + template_folder = create_template_folder(service=sample_service) + template = create_template(service=sample_service, folder=template_folder) + + data = { + 'archived': True, + } + + client.post( + f'/service/{sample_service.id}/template/{template.id}', + headers=[('Content-Type', 'application/json'), create_authorization_header()], + data=json.dumps(data) + ) + + updated_template = Template.query.get(template.id) + assert updated_template.archived + assert not updated_template.folder + + def test_get_precompiled_template_for_service( client, notify_user,