summaryrefslogtreecommitdiff
path: root/tests/template_tests/tests.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2015-01-08 15:03:43 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2015-01-12 21:01:34 +0100
commita3e783fe11dd25bbf84bfb6201186566ed473506 (patch)
tree1fe6a54ab582e54f6b1f065f2236bfe2185ce254 /tests/template_tests/tests.py
parent71b7668b75d10589bbbdc7c5ca9ee7a125f91c90 (diff)
Deprecated passing a Context to a generic Template.render.
A deprecation path is required because the return type of django.template.loader.get_template changed during the multiple template engines refactor. test_csrf_token_in_404 was incorrect: it tested the case when the hardcoded template was rendered, and that template doesn't depend on the CSRF token. This commit makes it test the case when a custom template is rendered.
Diffstat (limited to 'tests/template_tests/tests.py')
-rw-r--r--tests/template_tests/tests.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index b404a83098..8b93039dca 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -156,7 +156,7 @@ class TemplateLoaderTests(SimpleTestCase):
r = None
try:
tmpl = loader.select_template([load_name])
- r = tmpl.render(template.Context({}))
+ r = tmpl.render()
except template.TemplateDoesNotExist as e:
self.assertEqual(e.args[0], 'missing.html')
self.assertEqual(r, None, 'Template rendering unexpectedly succeeded, produced: ->%r<-' % r)
@@ -182,7 +182,7 @@ class TemplateLoaderTests(SimpleTestCase):
tmpl = loader.get_template(load_name)
r = None
try:
- r = tmpl.render(template.Context({}))
+ r = tmpl.render()
except template.TemplateDoesNotExist as e:
self.assertEqual(e.args[0], 'missing.html')
self.assertEqual(r, None, 'Template rendering unexpectedly succeeded, produced: ->%r<-' % r)
@@ -207,7 +207,7 @@ class TemplateLoaderTests(SimpleTestCase):
tmpl = loader.get_template(load_name)
r = None
try:
- r = tmpl.render(template.Context({}))
+ r = tmpl.render()
except template.TemplateDoesNotExist as e:
self.assertEqual(e.args[0], 'missing.html')
self.assertEqual(r, None, 'Template rendering unexpectedly succeeded, produced: ->%r<-' % r)
@@ -216,7 +216,7 @@ class TemplateLoaderTests(SimpleTestCase):
# result that behaves incorrectly on subsequent attempts.
tmpl = loader.get_template(load_name)
try:
- tmpl.render(template.Context({}))
+ tmpl.render()
except template.TemplateDoesNotExist as e:
self.assertEqual(e.args[0], 'missing.html')
self.assertEqual(r, None, 'Template rendering unexpectedly succeeded, produced: ->%r<-' % r)
@@ -262,7 +262,7 @@ class TemplateLoaderTests(SimpleTestCase):
t = loader.get_template('recursive_include.html')
self.assertEqual(
"Recursion! A1 Recursion! B1 B2 B3 Recursion! C1",
- t.render(Context({'comments': comments})).replace(' ', '').replace('\n', ' ').strip(),
+ t.render({'comments': comments}).replace(' ', '').replace('\n', ' ').strip(),
)
@@ -400,7 +400,7 @@ class TemplateRegressionTests(SimpleTestCase):
"""
t = loader.get_template('included_content.html')
with self.assertRaises(urlresolvers.NoReverseMatch):
- t.render(Context({}))
+ t.render()
def test_debug_tag_non_ascii(self):
"""