summaryrefslogtreecommitdiff
path: root/tests/view_tests
diff options
context:
space:
mode:
authorTom Forbes <tom@tomforb.es>2020-07-13 08:01:59 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-07-13 08:06:21 +0200
commitf36862b69c3325da8ba6892a6057bbd9470efd70 (patch)
treefa4c2b2b27bba7c8b9ad402db1a795c2b0ef95a2 /tests/view_tests
parentb7a438c7e21cdcb26d47f1c1fc5afdc1b3d1a9ef (diff)
downloaddjango-f36862b69c3325da8ba6892a6057bbd9470efd70.tar.gz
Fixed #31674 -- Made technical 500 debug page respect __suppress_context__.
Diffstat (limited to 'tests/view_tests')
-rw-r--r--tests/view_tests/tests/test_debug.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 1276f061fa..bb5a45224d 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -391,6 +391,26 @@ class ExceptionReporterTests(SimpleTestCase):
self.assertIn('<h2>Request information</h2>', html)
self.assertNotIn('<p>Request data not supplied</p>', html)
+ def test_suppressed_context(self):
+ try:
+ try:
+ raise RuntimeError("Can't find my keys")
+ except RuntimeError:
+ raise ValueError("Can't find my keys") from None
+ except ValueError:
+ exc_type, exc_value, tb = sys.exc_info()
+
+ reporter = ExceptionReporter(None, exc_type, exc_value, tb)
+ html = reporter.get_traceback_html()
+ self.assertInHTML('<h1>ValueError</h1>', html)
+ self.assertIn('<pre class="exception_value">Can&#x27;t find my keys</pre>', html)
+ self.assertIn('<th>Exception Type:</th>', html)
+ self.assertIn('<th>Exception Value:</th>', html)
+ self.assertIn('<h2>Traceback ', html)
+ self.assertIn('<h2>Request information</h2>', html)
+ self.assertIn('<p>Request data not supplied</p>', html)
+ self.assertNotIn('During handling of the above exception', html)
+
def test_reporting_of_nested_exceptions(self):
request = self.rf.get('/test_view/')
try: