summaryrefslogtreecommitdiff
path: root/tests/modeltests/test_client/models.py
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 /tests/modeltests/test_client/models.py
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 'tests/modeltests/test_client/models.py')
-rw-r--r--tests/modeltests/test_client/models.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/modeltests/test_client/models.py b/tests/modeltests/test_client/models.py
index b6c3fbd5b1..74f5e9700c 100644
--- a/tests/modeltests/test_client/models.py
+++ b/tests/modeltests/test_client/models.py
@@ -114,4 +114,14 @@ class ClientTest(unittest.TestCase):
# Check that the session was modified
self.assertEquals(self.client.session['tobacconist'], 'hovercraft')
- \ No newline at end of file
+
+ def test_view_with_exception(self):
+ "Request a page that is known to throw an error"
+ self.assertRaises(KeyError, self.client.get, "/test_client/broken_view/")
+
+ #Try the same assertion, a different way
+ try:
+ self.client.get('/test_client/broken_view/')
+ self.fail('Should raise an error')
+ except KeyError:
+ pass