summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-01-30 21:26:17 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-01-30 21:34:39 +0100
commitd5ad9d3dfe729f8b605965e131c787fae9f84377 (patch)
tree01bb97e4e7bbde128f9df823c9354f8c73d0a377 /tests
parent5da6ce11edb60319c014c07c40b03674ea89de4c (diff)
[1.5.x] Fixed #19076 -- Added content_type attribute to TemplateView.
Thanks Gavin Wahl. Backport of 23e319d.
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/generic_views/base.py5
-rw-r--r--tests/regressiontests/generic_views/urls.py2
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/regressiontests/generic_views/base.py b/tests/regressiontests/generic_views/base.py
index c7ad7a0deb..fd2abb0aa7 100644
--- a/tests/regressiontests/generic_views/base.py
+++ b/tests/regressiontests/generic_views/base.py
@@ -312,6 +312,11 @@ class TemplateViewTest(TestCase):
self.assertNotEqual(response.content, response2.content)
+ def test_content_type(self):
+ response = self.client.get('/template/content_type/')
+ self.assertEqual(response['Content-Type'], 'text/plain')
+
+
class RedirectViewTest(unittest.TestCase):
rf = RequestFactory()
diff --git a/tests/regressiontests/generic_views/urls.py b/tests/regressiontests/generic_views/urls.py
index 9caf19365c..40c9a1b93a 100644
--- a/tests/regressiontests/generic_views/urls.py
+++ b/tests/regressiontests/generic_views/urls.py
@@ -20,6 +20,8 @@ urlpatterns = patterns('',
TemplateView.as_view(template_name='generic_views/about.html')),
(r'^template/custom/(?P<foo>\w+)/$',
views.CustomTemplateView.as_view(template_name='generic_views/about.html')),
+ (r'^template/content_type/$',
+ TemplateView.as_view(template_name='generic_views/robots.txt', content_type='text/plain')),
(r'^template/cached/(?P<foo>\w+)/$',
cache_page(2.0)(TemplateView.as_view(template_name='generic_views/about.html'))),