Changeset 7900
- Timestamp:
- 07/12/08 01:16:42 (6 months ago)
- Files:
-
- django/trunk/docs/testing.txt (modified) (2 diffs)
- django/trunk/tests/modeltests/test_client/models.py (modified) (1 diff)
- django/trunk/tests/modeltests/test_client/urls.py (modified) (1 diff)
- django/trunk/tests/modeltests/test_client/views.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/testing.txt
r7805 r7900 601 601 objects, in the order in which they were rendered. 602 602 603 ``headers`` The HTTP headers of the response. This is a dictionary.604 605 603 ``request`` The request data that stimulated the response. 606 604 … … 619 617 which they were rendered. 620 618 =============== ========================================================== 619 620 You can also use dictionary syntax on the response object to query the value 621 of any settings in the HTTP headers. For example, you could determine the 622 content type of a response using ``response['Content-Type']``. 621 623 622 624 .. _RFC2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html django/trunk/tests/modeltests/test_client/models.py
r6813 r7900 71 71 self.assertEqual(response.template.name, 'POST Template') 72 72 self.failUnless('Data received' in response.content) 73 73 74 def test_response_headers(self): 75 "Check the value of HTTP headers returned in a response" 76 response = self.client.get("/test_client/header_view/") 77 78 self.assertEquals(response['X-DJANGO-TEST'], 'Slartibartfast') 79 74 80 def test_raw_post(self): 75 81 "POST raw data (with a content type) to a view" django/trunk/tests/modeltests/test_client/urls.py
r6658 r7900 6 6 (r'^get_view/$', views.get_view), 7 7 (r'^post_view/$', views.post_view), 8 (r'^header_view/$', views.view_with_header), 8 9 (r'^raw_post_view/$', views.raw_post_view), 9 10 (r'^redirect_view/$', views.redirect_view), django/trunk/tests/modeltests/test_client/views.py
r6658 r7900 33 33 return HttpResponse(t.render(c)) 34 34 35 def view_with_header(request): 36 "A view that has a custom header" 37 response = HttpResponse() 38 response['X-DJANGO-TEST'] = 'Slartibartfast' 39 return response 40 35 41 def raw_post_view(request): 36 42 """A view which expects raw XML to be posted and returns content extracted
