- input = open(path.dirname(__file__) + '/but-w-butonierce-but-w-butonierce.xml')
- book = models.Book.from_text_and_meta(File(input), self.book_info, overwrite=True)
- book.build_pdf()
- self.assertTrue(path.exists(book.pdf_file.path))
-
- def test_gen_pdf_child(self):
- input = open(path.dirname(__file__) + "/fraszka-do-anusie.xml")
- book = models.Book.from_text_and_meta(File(input), self.book_info, overwrite=True)
- book.build_pdf()
- self.assertTrue(path.exists(book.pdf_file.path))
+ self.book.build_pdf()
+ self.assertTrue(path.exists(self.book.pdf_file.path))
+
+ def test_gen_pdf_parent(self):
+ """This book contains a child."""
+ input = path.join(path.dirname(__file__), "files/fraszki.xml")
+ parent = models.Book.from_xml_file(input)
+ parent.build_pdf()
+ self.assertTrue(path.exists(parent.pdf_file.path))
+
+ def test_custom_pdf(self):
+ out = models.get_dynamic_path(None, 'test-custom', ext='pdf')
+ absoulute_path = path.join(settings.MEDIA_ROOT, out)
+
+ if not path.exists(path.dirname(absoulute_path)):
+ makedirs(path.dirname(absoulute_path))
+
+ self.book.build_pdf(customizations=['nofootnotes', '13pt', 'a4paper'], file_name=out)
+ self.assertTrue(path.exists(absoulute_path))