summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2007-08-17 14:20:25 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2007-08-17 14:20:25 +0000
commit8dff1cd91dcef967c2bbcf23b4a32458c0e0f83f (patch)
treee316bfb9563bf4225e8d68695ead0d3a9807b12f /docs
parent55c0b35acf6aad2c5287d196bed6eadb0cc50486 (diff)
Fixed #5189 -- Added logout method to test Client. Thanks, Jakub Wisniowski <restless.being@gmail.com>.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/testing.txt17
1 files changed, 14 insertions, 3 deletions
diff --git a/docs/testing.txt b/docs/testing.txt
index 4e723a1020..f189aa4578 100644
--- a/docs/testing.txt
+++ b/docs/testing.txt
@@ -550,6 +550,17 @@ Once you have a ``Client`` instance, you can call any of the following methods:
conditions. You'll need to create users as part of the test suite -- either
manually (using the Django model API) or with a test fixture.
+``logout()``
+ **New in Django development version**
+
+ If your site uses Django's `authentication system`_, the ``logout()``
+ method can be used to simulate the effect of a user logging out of
+ your site.
+
+ After you call this method, the test client will have all the cookies and
+ session data cleared to defaults. Subsequent requests will appear to
+ come from an AnonymousUser.
+
.. _authentication system: ../authentication/
.. _authentication backend: ../authentication/#other-authentication-sources
@@ -758,7 +769,7 @@ Here's specifically what will happen:
* At the start of each test case, before ``setUp()`` is run, Django will
flush the database, returning the database to the state it was in
directly after ``syncdb`` was called.
-
+
* Then, all the named fixtures are installed. In this example, Django will
install any JSON fixture named ``mammals``, followed by any fixture named
``birds``. See the `loaddata documentation`_ for more details on defining
@@ -843,7 +854,7 @@ The test runner accomplishes this by transparently replacing the normal
effect on any other e-mail senders outside of Django, such as your machine's
mail server, if you're running one.)
-During test running, each outgoing e-mail is saved in
+During test running, each outgoing e-mail is saved in
``django.core.mail.outbox``. This is a simple list of all `EmailMessage`_
instances that have been sent. It does not exist under normal execution
conditions, i.e., when you're not running unit tests. The outbox is created
@@ -977,7 +988,7 @@ a number of utility methods in the ``django.test.utils`` module.
``autoclobber`` describes the behavior that will occur if a database with
the same name as the test database is discovered:
-
+
* If ``autoclobber`` is ``False``, the user will be asked to approve
destroying the existing database. ``sys.exit`` is called if the user
does not approve.