Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge f691fd7 into 17f3e92

  • Loading branch information...
commit d7ea528c8952191a5b6158c4a2e317009f22468e 2 parents 17f3e92 + f691fd7
GitHub Merge Button authored
Showing with 26 additions and 3 deletions.
  1. +2 −1  AUTHORS
  2. +24 −2 docs/topics/testing.txt
View
3  AUTHORS
@@ -136,9 +136,10 @@ answer newbie questions, and generally made Django that much better:
Robert Coup
Pete Crosier <pete.crosier@gmail.com>
Matt Croydon <http://www.postneo.com/>
+ Jure Cuhalev <gandalf@owca.info>
Leah Culver <leah.culver@gmail.com>
+ Raúl Cumplido <raulcumplido@gmail.com>
flavio.curella@gmail.com
- Jure Cuhalev <gandalf@owca.info>
John D'Agostino <john.dagostino@gmail.com>
dackze+django@gmail.com
Jim Dalton <jim.dalton@gmail.com>
View
26 docs/topics/testing.txt
@@ -664,11 +664,33 @@ Note a few important things about how the test client works:
Making requests
~~~~~~~~~~~~~~~
-Use the ``django.test.client.Client`` class to make requests. It requires no
-arguments at time of construction:
+Use the ``django.test.client.Client`` class to make requests.
.. class:: Client()
+ It requires no arguments at time of construction but you can provide some
+ default values:
+
+ .. method:: Client.__init__(enforce_csrf_checks=False, **defaults)
+
+ Creates an instance of the test client.
+
+ The ``defaults`` keywords argument parameter can be used to specify
+ some default headers to be sent in the request. For example::
+
+ >>> c = Client(HTTP_USER_AGENT='Mozilla/5.0')
+
+ ...will send the HTTP header ``HTTP_USER_AGENT`` on further requests.
+
+ The values from the ``extra`` keywords argument on the
+ :meth:`django.test.client.Client.get()`,
+ :meth:`django.test.client.Client.post()`,
+ :meth:`django.test.client.Client.delete()`
+ , etc. have precedence than those defaults provided.
+
+ By default the test client will disable any CSRF checks performed by
+ your site due to the default ``enforce_csrf_checks`` value.
+
Once you have a ``Client`` instance, you can call any of the following
methods:
Please sign in to comment.
Something went wrong with that request. Please try again.