mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31789 -- Added a new headers interface to HttpResponse.
This commit is contained in:
committed by
Mariusz Felisiak
parent
71ae1ab012
commit
bcc2befd0e
@@ -195,7 +195,7 @@ class ViewTest(SimpleTestCase):
|
||||
view = SimpleView.as_view()
|
||||
response = view(request)
|
||||
self.assertEqual(200, response.status_code)
|
||||
self.assertTrue(response['Allow'])
|
||||
self.assertTrue(response.headers['Allow'])
|
||||
|
||||
def test_options_for_get_view(self):
|
||||
"""
|
||||
@@ -226,7 +226,7 @@ class ViewTest(SimpleTestCase):
|
||||
|
||||
def _assert_allows(self, response, *expected_methods):
|
||||
"Assert allowed HTTP methods reported in the Allow response header"
|
||||
response_allows = set(response['Allow'].split(', '))
|
||||
response_allows = set(response.headers['Allow'].split(', '))
|
||||
self.assertEqual(set(expected_methods + ('OPTIONS',)), response_allows)
|
||||
|
||||
def test_args_kwargs_request_on_self(self):
|
||||
@@ -390,7 +390,7 @@ class TemplateViewTest(SimpleTestCase):
|
||||
|
||||
def test_content_type(self):
|
||||
response = self.client.get('/template/content_type/')
|
||||
self.assertEqual(response['Content-Type'], 'text/plain')
|
||||
self.assertEqual(response.headers['Content-Type'], 'text/plain')
|
||||
|
||||
def test_resolve_view(self):
|
||||
match = resolve('/template/content_type/')
|
||||
@@ -461,12 +461,12 @@ class RedirectViewTest(SimpleTestCase):
|
||||
"Named pattern parameter should reverse to the matching pattern"
|
||||
response = RedirectView.as_view(pattern_name='artist_detail')(self.rf.get('/foo/'), pk=1)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response['Location'], '/detail/artist/1/')
|
||||
self.assertEqual(response.headers['Location'], '/detail/artist/1/')
|
||||
|
||||
def test_named_url_pattern_using_args(self):
|
||||
response = RedirectView.as_view(pattern_name='artist_detail')(self.rf.get('/foo/'), 1)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response['Location'], '/detail/artist/1/')
|
||||
self.assertEqual(response.headers['Location'], '/detail/artist/1/')
|
||||
|
||||
def test_redirect_POST(self):
|
||||
"Default is a temporary redirect"
|
||||
|
||||
Reference in New Issue
Block a user