aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Sabchuk <michel@turbosys.com.br>2014-09-01 10:49:42 -0300
committerMichel Sabchuk <michel@turbosys.com.br>2014-09-01 10:49:42 -0300
commitb6d9a18528e79673412714fb7c6d3e9826e89421 (patch)
treeb4c1ce21576df4b54f10d55b6ea4f8f7522e6c1c
parent3e5f6553c8e51e8304004419e48fd169f84ca91e (diff)
downloaddjango-wkhtmltopdf-b6d9a18528e79673412714fb7c6d3e9826e89421.tar.gz
django-wkhtmltopdf-b6d9a18528e79673412714fb7c6d3e9826e89421.tar.bz2
django-wkhtmltopdf-b6d9a18528e79673412714fb7c6d3e9826e89421.zip
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.
-rw-r--r--wkhtmltopdf/tests/tests.py23
1 files 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('/')