From 3e5f6553c8e51e8304004419e48fd169f84ca91e Mon Sep 17 00:00:00 2001 From: Michel Sabchuk Date: Mon, 1 Sep 2014 10:25:11 -0300 Subject: Add failing test of unicode content. --- wkhtmltopdf/tests/tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'wkhtmltopdf/tests') diff --git a/wkhtmltopdf/tests/tests.py b/wkhtmltopdf/tests/tests.py index f296c8e..0c332f6 100644 --- a/wkhtmltopdf/tests/tests.py +++ b/wkhtmltopdf/tests/tests.py @@ -59,6 +59,17 @@ class TestUtils(TestCase): finally: temp_file.close() + def test_wkhtmltopdf_with_unicode_content(self): + """A wkhtmltopdf call should render unicode content properly""" + title = u'♥' + response = PDFTemplateResponse(self.factory.get('/'), None, context={'title': title}) + temp_file = response.render_to_temporary_file('unicode.html') + try: + pdf_output = wkhtmltopdf(pages=[temp_file.name]) + self.assertTrue(pdf_output.startswith(b'%PDF'), pdf_output) + finally: + temp_file.close() + def test_PDFTemplateResponse_render_to_temporary_file(self): """Should render a template to a temporary file.""" title = 'A test template.' -- cgit v1.2.3