summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-07-03 07:47:05 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-07-03 07:47:05 +0000
commit7b5869e140379bb4a6525bc5e48a1dc069635d23 (patch)
tree0c065814defa80c88ce8244a63396c23d005a0e4 /docs
parent40f24b46357ec486487c50898185ff5caa2e46e2 (diff)
[1.0.X] Fixed #9607 -- Added documentation for the ``extra`` argument in test client methods. Thanks to jroes for the report and patch.
Merge of r11173 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@11174 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/testing.txt17
1 files changed, 15 insertions, 2 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
index d7820cbe46..f4f289ccd7 100644
--- a/docs/topics/testing.txt
+++ b/docs/topics/testing.txt
@@ -479,7 +479,7 @@ arguments at time of construction:
Once you have a ``Client`` instance, you can call any of the following
methods:
- .. method:: Client.get(path, data={})
+ .. method:: Client.get(path, data={}, **extra)
Makes a GET request on the provided ``path`` and returns a ``Response``
object, which is documented below.
@@ -494,7 +494,18 @@ arguments at time of construction:
/customers/details/?name=fred&age=7
- .. method:: Client.post(path, data={}, content_type=MULTIPART_CONTENT)
+ The ``extra`` keyword arguments parameter can be used to specify
+ headers to be sent in the request. For example::
+
+ >>> c = Client()
+ >>> c.get('/customers/details/', {'name': 'fred', 'age': 7},
+ ... HTTP_X_REQUESTED_WITH='XMLHttpRequest')
+
+ ...will send the HTTP header ``HTTP_X_REQUESTED_WITH`` to the
+ details view, which is a good way to test code paths that use the
+ :meth:`django.http.HttpRequest.is_ajax()` method.
+
+ .. method:: Client.post(path, data={}, content_type=MULTIPART_CONTENT, **extra)
Makes a POST request on the provided ``path`` and returns a
``Response`` object, which is documented below.
@@ -545,6 +556,8 @@ arguments at time of construction:
Note that you should manually close the file after it has been provided
to ``post()``.
+ The ``extra`` argument acts the same as for :meth:`Client.get`.
+
.. method:: Client.login(**credentials)
.. versionadded:: 1.0