diff options
| author | Preston Timmons <prestontimmons@gmail.com> | 2015-04-11 19:41:45 -0400 |
|---|---|---|
| committer | Preston Timmons <prestontimmons@gmail.com> | 2015-04-20 09:11:37 -0500 |
| commit | fb267a1d85c22924231be8cec6c58c42ae57913f (patch) | |
| tree | d85f9285bea1c37d7af83ebc5c84996d2e9d51dd /tests/template_tests/test_context.py | |
| parent | d84f01ff08922c70f9bb0861846c8ace0764b2dc (diff) | |
Updated template tests to create their own engine.
This continues work to treat Django templates as a library.
Diffstat (limited to 'tests/template_tests/test_context.py')
| -rw-r--r-- | tests/template_tests/test_context.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/tests/template_tests/test_context.py b/tests/template_tests/test_context.py index f7959e6415..9440f218cd 100644 --- a/tests/template_tests/test_context.py +++ b/tests/template_tests/test_context.py @@ -2,10 +2,10 @@ from django.http import HttpRequest from django.template import ( - Context, RequestContext, Template, Variable, VariableDoesNotExist, + Context, Engine, RequestContext, Variable, VariableDoesNotExist, ) from django.template.context import RenderContext -from django.test import RequestFactory, SimpleTestCase, override_settings +from django.test import RequestFactory, SimpleTestCase class ContextTests(SimpleTestCase): @@ -131,25 +131,20 @@ class ContextTests(SimpleTestCase): class RequestContextTests(SimpleTestCase): - @override_settings(TEMPLATES=[{ - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'OPTIONS': { - 'loaders': [ - ('django.template.loaders.locmem.Loader', { - 'child': '{{ var|default:"none" }}', - }), - ], - }, - }]) def test_include_only(self): """ #15721 -- ``{% include %}`` and ``RequestContext`` should work together. """ + engine = Engine(loaders=[ + ('django.template.loaders.locmem.Loader', { + 'child': '{{ var|default:"none" }}', + }), + ]) request = RequestFactory().get('/') ctx = RequestContext(request, {'var': 'parent'}) - self.assertEqual(Template('{% include "child" %}').render(ctx), 'parent') - self.assertEqual(Template('{% include "child" only %}').render(ctx), 'none') + self.assertEqual(engine.from_string('{% include "child" %}').render(ctx), 'parent') + self.assertEqual(engine.from_string('{% include "child" only %}').render(ctx), 'none') def test_stack_size(self): """ |
