Example #1
0
    def test_traceback_list(self):
        """Make sure tracebacks are included when they're lists."""
        ex = Exception("foo")
        ex.__traceback__ = traceback.extract_stack()

        resp = _debug_exception_to_reponse(Request(_env()), ex)
        body = json.loads(resp.body)
        self.assertTrue('traceback' in body)
        self.assertNotEqual(body['traceback'], ["No traceback available."])
Example #2
0
 def test_has_traceback(self):
     """Make sure there is a traceback."""
     resp = _debug_exception_to_reponse(Exception("foo"), "cookie")
     self.assertTrue('traceback' in json.loads(resp.body))
Example #3
0
 def test_has_cookie(self):
     """Make sure the cookie is included."""
     resp = _debug_exception_to_reponse(Exception("foo"), "cookie")
     body = json.loads(resp.body)
     self.assertTrue('cookie' in body)
     self.assertEqual(body['cookie'], 'cookie')
Example #4
0
 def test_has_detail(self):
     """Make sure there's error detail."""
     resp = _debug_exception_to_reponse(Exception("foo"), "cookie")
     body = json.loads(resp.body)
     self.assertTrue('detail' in body)
Example #5
0
 def test_status(self):
     """Make sure webob exception statuses are preserved."""
     not_found = exc.HTTPNotFound("Sorry")
     resp = _debug_exception_to_reponse(not_found)
     self.assertEqual(not_found.status, resp.status)
Example #6
0
 def test_types(self):
     resp = _debug_exception_to_reponse(Exception("foo"))
     self.assertTrue(isinstance(resp, Response))