summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris Beaven <smileychris@gmail.com>2011-04-17 04:52:31 +0000
committerChris Beaven <smileychris@gmail.com>2011-04-17 04:52:31 +0000
commitd59baa07f056b60942052b4809d71eecd323837a (patch)
tree9ea84e3047ce31a35f76401f1cfc7b696b2c4f59 /tests
parent89e25403ae9dfcdc3eabd66469226d3036c6cc06 (diff)
Fixes #15721 -- Make {% include %} and RequestContext work together again.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/templates/tests.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index a051d7335e..dedd7d5c92 100644
--- a/tests/regressiontests/templates/tests.py
+++ b/tests/regressiontests/templates/tests.py
@@ -1639,5 +1639,34 @@ class TemplateTagLoading(unittest.TestCase):
settings.INSTALLED_APPS = ('tagsegg',)
t = template.Template(ttext)
+
+class RequestContextTests(BaseTemplateResponseTest):
+
+ def setUp(self):
+ templates = {
+ 'child': Template('{{ var|default:"none" }}'),
+ }
+ setup_test_template_loader(templates)
+ self.fake_request = RequestFactory().get('/')
+
+ def tearDown(self):
+ restore_template_loaders()
+
+ def test_include_only(self):
+ """
+ Regression test for #15721, ``{% include %}`` and ``RequestContext``
+ not playing together nicely.
+ """
+ ctx = RequestContext(self.fake_request, {'var': 'parent'})
+ self.assertEqual(
+ template.Template('{% include "child" %}').render(ctx),
+ 'parent'
+ )
+ self.assertEqual(
+ template.Template('{% include "child" only %}').render(ctx),
+ 'none'
+ )
+
+
if __name__ == "__main__":
unittest.main()