From b6d9a18528e79673412714fb7c6d3e9826e89421 Mon Sep 17 00:00:00 2001 From: Michel Sabchuk Date: Mon, 1 Sep 2014 10:49:42 -0300 Subject: Makes unicode content views testing fails too. The view didn't define any title in context and the templates itself doen't have unicode content. I forced it making a view with a unicode title in context. --- wkhtmltopdf/tests/tests.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/wkhtmltopdf/tests/tests.py b/wkhtmltopdf/tests/tests.py index 0c332f6..e3aa869 100644 --- a/wkhtmltopdf/tests/tests.py +++ b/wkhtmltopdf/tests/tests.py @@ -17,6 +17,18 @@ from wkhtmltopdf.utils import (_options_to_args, make_absolute_paths, from wkhtmltopdf.views import PDFResponse, PDFTemplateView, PDFTemplateResponse +class UnicodeContentPDFTemplateView(PDFTemplateView): + """ + PDFTemplateView with the addition of unicode content in his context. + + Used in unicode content view testing. + """ + def get_context_data(self, **kwargs): + Base = super(UnicodeContentPDFTemplateView, self) + context = Base.get_context_data(**kwargs) + context['title'] = u'♥' + return context + class TestUtils(TestCase): def setUp(self): # Clear standard error @@ -244,11 +256,12 @@ class TestViews(TestCase): self.test_pdf_template_view(show_content=True) def test_pdf_template_view_unicode(self, show_content=False): - """Test PDFTemplateView.""" - - view = PDFTemplateView.as_view(filename=self.pdf_filename, - show_content_in_browser=show_content, - template_name=self.template) + """Test PDFTemplateView with unicode content.""" + view = UnicodeContentPDFTemplateView.as_view( + filename=self.pdf_filename, + show_content_in_browser=show_content, + template_name=self.template + ) # As PDF request = RequestFactory().get('/') -- cgit v1.2.3