summaryrefslogtreecommitdiff
path: root/tests/test_client
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-28 11:21:26 -0400
committerTim Graham <timograham@gmail.com>2016-07-01 09:58:56 -0400
commit567cfc1601a5f475eea12bc5de53b849fa5dadea (patch)
treec471ba1af748008e4fbe9faee8cf51d4dffcd263 /tests/test_client
parent9c48e17480432b8723fcdcc262d8d62866e93a4f (diff)
[1.10.x] Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions. Backport of c9ae09addffb839403312131d4251e9d8b454508 from master
Diffstat (limited to 'tests/test_client')
-rw-r--r--tests/test_client/tests.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 833306a4a9..5594e71e12 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -598,14 +598,10 @@ class ClientTest(TestCase):
def test_session_modifying_view(self):
"Request a page that modifies the session"
# Session value isn't set initially
- try:
+ with self.assertRaises(KeyError):
self.client.session['tobacconist']
- self.fail("Shouldn't have a session value")
- except KeyError:
- pass
self.client.post('/session_view/')
-
# Check that the session was modified
self.assertEqual(self.client.session['tobacconist'], 'hovercraft')
@@ -629,13 +625,6 @@ class ClientTest(TestCase):
with self.assertRaises(KeyError):
self.client.get("/broken_view/")
- # Try the same assertion, a different way
- try:
- self.client.get('/broken_view/')
- self.fail('Should raise an error')
- except KeyError:
- pass
-
def test_mail_sending(self):
"Test that mail is redirected to a dummy outbox during test setup"