summaryrefslogtreecommitdiff
path: root/tests/template_backends
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2018-11-26 14:01:27 -0500
committerTim Graham <timograham@gmail.com>2018-11-27 09:49:02 -0500
commit0f212db29d361ec6219b170198b7c94d0bb3f719 (patch)
treeb4a1a93f3d5b725ed9d08896892f1a3f5e191ab7 /tests/template_backends
parent7f63b894c02effb09c15ab0b40d28b89553b8e37 (diff)
downloaddjango-0f212db29d361ec6219b170198b7c94d0bb3f719.tar.gz
Made reused RequestFactory instances class attributes.
Diffstat (limited to 'tests/template_backends')
-rw-r--r--tests/template_backends/test_django.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/template_backends/test_django.py b/tests/template_backends/test_django.py
index 567537f7a2..e7a4a03546 100644
--- a/tests/template_backends/test_django.py
+++ b/tests/template_backends/test_django.py
@@ -12,6 +12,7 @@ class DjangoTemplatesTests(TemplateStringsTests):
engine_class = DjangoTemplates
backend_name = 'django'
+ request_factory = RequestFactory()
def test_context_has_priority_over_template_context_processors(self):
# See ticket #23789.
@@ -25,7 +26,7 @@ class DjangoTemplatesTests(TemplateStringsTests):
})
template = engine.from_string('{{ processors }}')
- request = RequestFactory().get('/')
+ request = self.request_factory.get('/')
# Context processors run
content = template.render({}, request)
@@ -45,7 +46,7 @@ class DjangoTemplatesTests(TemplateStringsTests):
})
template = engine.from_string('')
context = Context()
- request_context = RequestContext(RequestFactory().get('/'), {})
+ request_context = RequestContext(self.request_factory.get('/'), {})
msg = 'context must be a dict rather than Context.'
with self.assertRaisesMessage(TypeError, msg):
template.render(context)