summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-07-11 12:34:27 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-07-11 12:34:27 +0200
commit3e013d7f3b403de865f0ae612d272099dda3004c (patch)
treed37afa4bd2df2072a591465a4f48a3169c666c78 /archaeological_operations
parentebe377034f250b31f21540dbc9344d7ed328dd2e (diff)
downloadIshtar-3e013d7f3b403de865f0ae612d272099dda3004c.tar.bz2
Ishtar-3e013d7f3b403de865f0ae612d272099dda3004c.zip
Simple migration script for old ODT templates (refs #3602)
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/tests.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index f2bb390bd..8ca14179f 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -1124,6 +1124,38 @@ class RegisterTest(TestCase, OperationInitTest):
z.close()
f.close()
+ def test_document_migration(self):
+ fe = FileInit()
+ fe.create_file()
+
+ from archaeological_files.tests import create_administrativact as ca_fle
+ ca_fle(self.user, fe.item)
+
+ tpl = open(
+ settings.ROOT_PATH +
+ '../ishtar_common/tests/old.odt',
+ 'rb')
+ template = SimpleUploadedFile(tpl.name, tpl.read())
+ doc = DocumentTemplate.objects.create(
+ name="Old",
+ associated_object_name=DocumentTemplate.CLASSNAMES[0][0],
+ available=True,
+ template=template
+ )
+ self.act_types[0].associated_template.add(doc)
+
+ doc.convert_from_v1()
+ with open(doc.template.path) as f:
+ try:
+ z = zipfile.ZipFile(f)
+ self.assertIsNone(z.testzip())
+ c = z.open('content.xml')
+ content = c.read()
+ self.assertIn('{{ adminact_operator_id }}', content)
+ finally:
+ c.close()
+ z.close()
+
class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase):
fixtures = [settings.ROOT_PATH +