summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-08-13 16:18:15 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-08-20 10:05:08 +0200
commit48d2ff9e5dfd6fb1108396252d4291683b6e2819 (patch)
treecfa03ba2db4a8abc9130362d6997a2896f6cf3bf
parent238a29bbc2c7e4325f59e66ac4cbec8bf05430f4 (diff)
downloadIshtar-48d2ff9e5dfd6fb1108396252d4291683b6e2819.tar.bz2
Ishtar-48d2ff9e5dfd6fb1108396252d4291683b6e2819.zip
✅ fix test for template generation
-rw-r--r--archaeological_operations/tests.py36
-rwxr-xr-xarchaeological_operations/tests/template_adminact.odtbin0 -> 10314 bytes
2 files changed, 35 insertions, 1 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index caadbc94f..d346b56e1 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -3753,7 +3753,7 @@ class RegisterTest(TestCase, OperationInitTest):
def test_document_generation(self):
tpl = open(
settings.LIB_BASE_PATH +
- "archaeological_operations/tests/document_reference.odt",
+ "archaeological_operations/tests/template_adminact.odt",
"rb",
)
template = SimpleUploadedFile(tpl.name, tpl.read())
@@ -3791,6 +3791,40 @@ class RegisterTest(TestCase, OperationInitTest):
if f:
f.close()
+ def test_document_ref_generation(self):
+ tpl = open(
+ settings.LIB_BASE_PATH +
+ "archaeological_operations/tests/document_reference.odt",
+ "rb",
+ )
+ template = SimpleUploadedFile(tpl.name, tpl.read())
+ model, __ = ImporterModel.objects.get_or_create(
+ klass="archaeological_operations.models.AdministrativeAct"
+ )
+ doc = DocumentTemplate.objects.create(
+ name="Test",
+ slug=True,
+ associated_model=model,
+ available=True,
+ template=template,
+ )
+ self.act_types[0].associated_template.add(doc)
+
+ c = Client()
+ data = {"pk": self.admin_acts[0].pk, "document_template": doc.pk}
+ response = c.post(reverse("operation-administrativeact-document"), data)
+ # no result when no authentication
+ self.assertEqual(response.content, b"")
+ c.login(username=self.username, password=self.password)
+ response = c.post(reverse("operation-administrativeact-document"), data)
+ f = None
+ try:
+ f = BytesIO(response.content)
+ self.assertIn(b"2014-05-12", f.read())
+ finally:
+ if f:
+ f.close()
+
class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase):
fixtures = FILE_FIXTURES
diff --git a/archaeological_operations/tests/template_adminact.odt b/archaeological_operations/tests/template_adminact.odt
new file mode 100755
index 000000000..56c007200
--- /dev/null
+++ b/archaeological_operations/tests/template_adminact.odt
Binary files differ