summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-05-16 18:28:37 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-07-08 09:58:50 +0200
commit462d84cf5a8787b55fb31d6012b5b496e52190df (patch)
tree516d4c8fd2a97bef665b37b7d71149988d2947d7 /ishtar_common/tests.py
parent03df2dd4e3f21f8e134d0d6cd70b05401872a2ef (diff)
downloadIshtar-462d84cf5a8787b55fb31d6012b5b496e52190df.tar.bz2
Ishtar-462d84cf5a8787b55fb31d6012b5b496e52190df.zip
Generate preview image for PDF
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r--ishtar_common/tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 6b200ef39..0c790bdd5 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -3656,6 +3656,24 @@ class DocumentTest(TestCase):
doc.operations.add(self.ope1)
self.assertEqual(doc.operations.count(), 0)
+ def test_generate_pdftoppm(self):
+ if not settings.PDFTOPPM_BINARY:
+ return
+ pdf_path = os.path.join(
+ settings.ROOT_PATH, "..", "ishtar_common", "tests", "simple.pdf"
+ )
+ doc = models.Document.objects.create(
+ title="Document",
+ associated_file=SimpleUploadedFile(
+ name="simple.pdf",
+ content=open(pdf_path, "rb").read(),
+ content_type="application/pdf",
+ )
+ )
+ doc.operations.add(self.ope1)
+ doc = models.Document.objects.get(id=doc.pk)
+ self.assertTrue(doc.image.path)
+
def test_create_with_parent(self):
doc = models.Document.objects.create(title="Parent document")
doc.operations.add(self.ope1)