mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Removed support for passing a context to a generic Template.render().
Per deprecation timeline; refs a3e783fe11
.
This commit is contained in:
parent
4811f09fa3
commit
9114fe8ada
4 changed files with 4 additions and 70 deletions
|
@ -1,10 +1,8 @@
|
|||
from template_tests.test_response import test_processor_name
|
||||
|
||||
from django.template import RequestContext
|
||||
from django.template.backends.django import DjangoTemplates
|
||||
from django.template.library import InvalidTemplateLibrary
|
||||
from django.test import RequestFactory, ignore_warnings, override_settings
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.test import RequestFactory, override_settings
|
||||
|
||||
from .test_dummy import TemplateStringsTests
|
||||
|
||||
|
@ -36,23 +34,6 @@ class DjangoTemplatesTests(TemplateStringsTests):
|
|||
content = template.render({'processors': 'no'}, request)
|
||||
self.assertEqual(content, 'no')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_request_context_conflicts_with_request(self):
|
||||
template = self.engine.from_string('hello')
|
||||
|
||||
request = RequestFactory().get('/')
|
||||
request_context = RequestContext(request)
|
||||
# This doesn't raise an exception.
|
||||
template.render(request_context, request)
|
||||
|
||||
other_request = RequestFactory().get('/')
|
||||
msg = ("render() was called with a RequestContext and a request "
|
||||
"argument which refer to different requests. Make sure "
|
||||
"that the context argument is a dict or at least that "
|
||||
"the two arguments refer to the same request.")
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
template.render(request_context, other_request)
|
||||
|
||||
@override_settings(INSTALLED_APPS=['template_backends.apps.good'])
|
||||
def test_templatetag_discovery(self):
|
||||
engine = DjangoTemplates({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue