aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wkhtmltopdf/tests.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/wkhtmltopdf/tests.py b/wkhtmltopdf/tests.py
index 0249cb5..f50d8f2 100644
--- a/wkhtmltopdf/tests.py
+++ b/wkhtmltopdf/tests.py
@@ -4,10 +4,22 @@ import os
from django.test import TestCase
-from .utils import template_to_temp_file
+from .utils import template_to_temp_file, wkhtmltopdf
class TestUtils(TestCase):
+ def test_wkhtmltopdf(self):
+ """Should run wkhtmltopdf to generate a PDF"""
+ title = 'A test template.'
+ temp_file = template_to_temp_file('sample.html', {'title': title})
+ pdf_output = None
+ try:
+ pdf_output = wkhtmltopdf(pages=[temp_file])
+ finally:
+ if os.path.exists(temp_file):
+ os.remove(temp_file)
+ self.assertTrue(pdf_output.startswith('%PDF'), pdf_output)
+
def test_template_to_temp_file(self):
"""Should render a template to a temporary file."""
title = 'A test template.'