diff options
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 |
commit | c3102b11e4d20a008e6be81ddd5d1b8d4309be22 (patch) | |
tree | 516d4c8fd2a97bef665b37b7d71149988d2947d7 /ishtar_common/tests.py | |
parent | 1278dde057a343d6c09e829e43b66e8a95840910 (diff) | |
download | Ishtar-c3102b11e4d20a008e6be81ddd5d1b8d4309be22.tar.bz2 Ishtar-c3102b11e4d20a008e6be81ddd5d1b8d4309be22.zip |
Generate preview image for PDF
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r-- | ishtar_common/tests.py | 18 |
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) |