diff options
| author | Carl Meyer <carl@oddbird.net> | 2010-10-10 02:16:33 +0000 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2010-10-10 02:16:33 +0000 |
| commit | 501546df6f4cbb56ea94da073e8206804fef3040 (patch) | |
| tree | 767b30579c796b9fd9c94d1f8d30a4efb15d6d65 /tests/regressiontests | |
| parent | d084439c415e2037a1d13b217b044fd1bf3b39cb (diff) | |
Fixed #12226 -- Deprecated test client Response.template attribute in favor of templates attribute, which is always a list. Thanks Russell for patch review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/test_client_regress/models.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py index 22b59e54a9..20ed3af82f 100644 --- a/tests/regressiontests/test_client_regress/models.py +++ b/tests/regressiontests/test_client_regress/models.py @@ -9,7 +9,7 @@ from django.test import Client, TestCase from django.test.utils import ContextList from django.core.urlresolvers import reverse from django.core.exceptions import SuspiciousOperation -from django.template import TemplateDoesNotExist, TemplateSyntaxError, Context +from django.template import TemplateDoesNotExist, TemplateSyntaxError, Context, Template from django.template import loader from django.test.client import encode_file @@ -861,3 +861,18 @@ class RequestHeadersTest(TestCase): self.assertEquals(response.content, "HTTP_X_ARG_CHECK: Testing 123") self.assertRedirects(response, '/test_client_regress/check_headers/', status_code=301, target_status_code=200) + +class ResponseTemplateDeprecationTests(TestCase): + """ + Response.template still works backwards-compatibly, but with pending deprecation warning. Refs #12226. + + """ + def test_response_template_data(self): + response = self.client.get("/test_client_regress/request_data/", data={'foo':'whiz'}) + self.assertEqual(response.template.__class__, Template) + self.assertEqual(response.template.name, 'base.html') + + def test_response_no_template(self): + response = self.client.get("/test_client_regress/request_methods/") + self.assertEqual(response.template, None) + |
