Description

Consider this test case:

def test_user_can_only_remove_his_own_notifications(self):
notification_id = ... # set notification_id based on some knowledge of what exists in the DB
self.login_as_user(1) # this is a custom method defined in a base test class
try:
self.client.post("/notifications/remove/%d" % notification_id)
self.fail("User should not be able to remove notifications " +
"that do not belong to him")
except MaliciousOperation:
pass
# make sure the notification still exists...
self.login_as_user(2)
response = self.client.get("/")
self.assertEqual(notification_id, response.context[0]['notifications'][0].id)

This causes the exception to be re-raised, by the test client, upon calling self.client.get(), as the exception info was never cleared after/during the call to self.client.post().