tests: make test_finish_failed_request work standalone (#36515)

This commit is contained in:
Frédéric Péters 2019-11-19 14:32:57 +01:00
parent 57f96ee3b4
commit f1b90ce1e2
1 changed files with 7 additions and 1 deletions

View File

@ -62,10 +62,16 @@ def test_plaintext_error():
assert not re.findall('^>.*\d+.*s = pub._generate_plaintext_error', s, re.MULTILINE)
def test_finish_failed_request():
pub.USE_LONG_TRACES = False
try:
raise Exception('foo')
except:
exc_type, exc_value, tb = sys.exc_info()
req = get_request()
pub._set_request(req)
body = pub.finish_failed_request()
assert '<h1>Internal Server Error</h1>' in body
assert '<h1>Internal Server Error</h1>' in str(body)
req = get_request()
pub._set_request(req)