summaryrefslogtreecommitdiff
path: root/docs/testing.txt
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2007-02-11 00:23:31 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2007-02-11 00:23:31 +0000
commitf9cdde0cb41851e9d1eb70bd108debb75f267585 (patch)
treeb8f45306df30bccc5e10d1e8fd6f052764b201b7 /docs/testing.txt
parent23272de5dbc9429180e309883ffd021026bd4921 (diff)
Fixed #3162 -- Added coded to catch and rethrow exceptions that are thrown by the views visited by the test client. Thanks, Ben <afternoon@uk2.net>.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4482 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/testing.txt')
-rw-r--r--docs/testing.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/testing.txt b/docs/testing.txt
index 9906749723..cab31ed63b 100644
--- a/docs/testing.txt
+++ b/docs/testing.txt
@@ -291,6 +291,17 @@ for testing purposes:
.. _RFC2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
+Exceptions
+~~~~~~~~~~
+
+If you point the Test Client at a view that raises an exception, that exception
+will be visible in the test case. You can then use a standard ``try...catch``
+block, or ``unittest.TestCase.assertRaises()`` to test for exceptions.
+
+The only exceptions that are not visible in a Test Case are ``Http404``,
+``PermissionDenied`` and ``SystemExit``. Django catches these exceptions
+internally and converts them into the appropriate HTTP responses codes.
+
Persistent state
~~~~~~~~~~~~~~~~