TG-48 nouveau test
This commit is contained in:
parent
719aadf613
commit
58941613ed
@ -3,8 +3,11 @@ import os
|
|||||||
import unittest
|
import unittest
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
from pdfjinja import PdfJinja
|
from pdfjinja import PdfJinja
|
||||||
|
|
||||||
|
from app.tools.pdfjinja.insertTemplate import remplirTemplate
|
||||||
|
|
||||||
|
|
||||||
class insertTemplateTestCase(unittest.TestCase):
|
class insertTemplateTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@ -36,11 +39,14 @@ class insertTemplateTestCase(unittest.TestCase):
|
|||||||
del self.pdfjinja
|
del self.pdfjinja
|
||||||
|
|
||||||
def test_render(self):
|
def test_render(self):
|
||||||
|
remplirTemplate(self.datadir,"sample.pdf",self.datadir,"output.pdf",self.data)
|
||||||
output = self.pdfjinja(self.data)
|
output = self.pdfjinja(self.data)
|
||||||
outfile = BytesIO()
|
outfile = BytesIO()
|
||||||
output.write(outfile)
|
output.write(outfile)
|
||||||
outfile.seek(0)
|
outfile.seek(0)
|
||||||
self.assertTrue(len(outfile.read()) > 0, "Output PDF is not empty.")
|
self.assertTrue(len(outfile.read()) > 0, "Output PDF is not empty.")
|
||||||
|
self.assertTrue(Path(self.datadir+"/output.pdf").is_file(),"Pdf généré inexistant")
|
||||||
|
os.remove(self.datadir+"/output.pdf")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user