MCPcopy
hub / github.com/django/django / test_no_request

Method test_no_request

tests/view_tests/tests/test_debug.py:602–621  ·  view source on GitHub ↗

An exception report can be generated without request

(self)

Source from the content-addressed store, hash-verified

600 self.assertIn("<p>No POST data</p>", html)
601
602 def test_no_request(self):
603 "An exception report can be generated without request"
604 try:
605 raise ValueError("Can't find my keys")
606 except ValueError:
607 exc_type, exc_value, tb = sys.exc_info()
608 reporter = ExceptionReporter(None, exc_type, exc_value, tb)
609 html = reporter.get_traceback_html()
610 self.assertInHTML("<h1>ValueError</h1>", html)
611 self.assertIn(
612 '<pre class="exception_value">Can&#x27;t find my keys</pre>', html
613 )
614 self.assertNotIn('<th scope="row">Request Method:</th>', html)
615 self.assertNotIn('<th scope="row">Request URL:</th>', html)
616 self.assertNotIn('<h3 id="user-info">USER</h3>', html)
617 self.assertIn('<th scope="row">Exception Type:</th>', html)
618 self.assertIn('<th scope="row">Exception Value:</th>', html)
619 self.assertIn("<h2>Traceback ", html)
620 self.assertIn("<h2>Request information</h2>", html)
621 self.assertIn("<p>Request data not supplied</p>", html)
622
623 def test_sharing_traceback(self):
624 try:

Callers

nothing calls this directly

Calls 3

get_traceback_htmlMethod · 0.95
ExceptionReporterClass · 0.90
assertInHTMLMethod · 0.80

Tested by

no test coverage detected