From 3bf4ef0c77f80e2ed7fab298679ab0c5f28bc900 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 3 Sep 2007 11:21:40 +0000 Subject: Fixed #4988 -- In the test client, Added tracking of the client and request that caused a response so that the assertRedirects check can use the correct client when following a redirect. Well spotted, alex@gc-web.de. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6039 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/testing.txt | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'docs') diff --git a/docs/testing.txt b/docs/testing.txt index bb62273bea..22a7e48a7a 100644 --- a/docs/testing.txt +++ b/docs/testing.txt @@ -577,13 +577,25 @@ Specifically, a ``Response`` object has the following attributes: =============== ========================================================== Attribute Description =============== ========================================================== - ``status_code`` The HTTP status of the response, as an integer. See - RFC2616_ for a full list of HTTP status codes. + ``client`` The test client that was used to make the request that + resulted in the response. ``content`` The body of the response, as a string. This is the final page content as rendered by the view, or any error message (such as the URL for a 302 redirect). + ``context`` The template ``Context`` instance that was used to render + the template that produced the response content. + + If the rendered page used multiple templates, then + ``context`` will be a list of ``Context`` + objects, in the order in which they were rendered. + + ``request`` The request data that stimulated the response. + + ``status_code`` The HTTP status of the response, as an integer. See + RFC2616_ for a full list of HTTP status codes. + ``template`` The ``Template`` instance that was used to render the final content. Use ``template.name`` to get the template's file name, if the template was loaded from a @@ -594,13 +606,6 @@ Specifically, a ``Response`` object has the following attributes: using `template inheritance`_ -- then ``template`` will be a list of ``Template`` instances, in the order in which they were rendered. - - ``context`` The template ``Context`` instance that was used to render - the template that produced the response content. - - As with ``template``, if the rendered page used multiple - templates, then ``context`` will be a list of ``Context`` - objects, in the order in which they were rendered. =============== ========================================================== .. _RFC2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html @@ -828,7 +833,7 @@ useful for testing Web applications: ``assertRedirects(response, expected_url, status_code=302, target_status_code=200)`` Asserts that the response return a ``status_code`` redirect status, - it redirected to ``expected_url`` (including any GET data), and the subsequent + it redirected to ``expected_url`` (including any GET data), and the subsequent page was received with ``target_status_code``. ``assertTemplateUsed(response, template_name)`` -- cgit v1.3