From 9b3d54257b5024393284f2b1002acdb09615a1f1 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 18 Jun 2025 16:51:11 +0200 Subject: ✨ Media exporter: naming template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_operations/tests.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'archaeological_operations/tests.py') diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 385337213..068ec3057 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -4232,6 +4232,24 @@ class OperationExportMediaTest(TestCase, TestPermissionQuery, OperationInitTest) exclude=[('operation_image_00002.png', True)] ) + def test_naming(self): + self.exporter.naming = "DOC-{{item_type}}-{{item.cached_label|slug}}" + self.exporter.cascade = True + self.exporter.save() + cr, find = self._add_find() + cr.documents.add(self.documents[0]) + find.documents.add(self.documents[0]) + + c = Client() + c.login(username=self.username, password=self.password) + response = c.get(self.export_url) + self._test_files( + response, + [(f'DOC-operation-{slugify(self.operation.cached_label)}.png', True), + (f'DOC-contextrecord-{slugify(cr.cached_label)}.png', True), + (f'DOC-find-{slugify(find.cached_label)}.png', True)] + ) + class LabelTest(TestCase, OperationInitTest): fixtures = FILE_FIXTURES -- cgit v1.2.3