diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-02-11 00:23:31 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-02-11 00:23:31 +0000 |
| commit | f9cdde0cb41851e9d1eb70bd108debb75f267585 (patch) | |
| tree | b8f45306df30bccc5e10d1e8fd6f052764b201b7 /docs/testing.txt | |
| parent | 23272de5dbc9429180e309883ffd021026bd4921 (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.txt | 11 |
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 ~~~~~~~~~~~~~~~~ |
