aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'wkhtmltopdf/tests.py')
-rw-r--r--wkhtmltopdf/tests.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/wkhtmltopdf/tests.py b/wkhtmltopdf/tests.py
index 19fde76..1802440 100644
--- a/wkhtmltopdf/tests.py
+++ b/wkhtmltopdf/tests.py
@@ -218,6 +218,24 @@ class TestViews(TestCase):
response = view(request)
self.assertEqual(response.status_code, 405)
+ def test_get_cmd_options(self):
+ # Default cmd_options
+ view = PDFTemplateView()
+ self.assertEqual(view.cmd_options, PDFTemplateView.cmd_options)
+ self.assertEqual(PDFTemplateView.cmd_options, {})
+
+ # Instantiate with new cmd_options
+ cmd_options = {'orientation': 'landscape'}
+ view = PDFTemplateView(cmd_options=cmd_options)
+ self.assertEqual(view.cmd_options, cmd_options)
+ self.assertEqual(PDFTemplateView.cmd_options, {})
+
+ # Update local instance of cmd_options
+ view = PDFTemplateView()
+ view.cmd_options.update(cmd_options)
+ self.assertEqual(view.cmd_options, cmd_options)
+ self.assertEqual(PDFTemplateView.cmd_options, {})
+
def test_deprecated(self):
"""Should warn when using deprecated views."""
with warnings.catch_warnings(record=True) as w:
@@ -236,3 +254,11 @@ class TestViews(TestCase):
self.assertTrue(
'PDFResponse' in str(w[0].message),
"'PDFResponse' not in {!r}".format(w[0].message))
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter('always')
+ PDFTemplateView().get_pdf_kwargs()
+ self.assertEqual(len(w), 1)
+ self.assertEqual(w[0].category, PendingDeprecationWarning)
+ self.assertTrue(
+ 'get_pdf_kwargs()' in str(w[0].message),
+ "'get_pdf_kwargs()' not in {!r}".format(w[0].message))