|
|
@ -791,6 +791,26 @@ def test_error_handling_processing(): |
|
|
|
assert resp.data == b'internal server error' |
|
|
|
assert resp.data == b'internal server error' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_baseexception_error_handling(): |
|
|
|
|
|
|
|
app = flask.Flask(__name__) |
|
|
|
|
|
|
|
app.config['LOGGER_HANDLER_POLICY'] = 'never' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/') |
|
|
|
|
|
|
|
def broken_func(): |
|
|
|
|
|
|
|
raise KeyboardInterrupt() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with app.test_client() as c: |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
c.get('/') |
|
|
|
|
|
|
|
raise AssertionError("KeyboardInterrupt should have been raised") |
|
|
|
|
|
|
|
except KeyboardInterrupt: |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctx = flask._request_ctx_stack.top |
|
|
|
|
|
|
|
assert ctx.preserved |
|
|
|
|
|
|
|
assert type(ctx._preserved_exc) is KeyboardInterrupt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_before_request_and_routing_errors(): |
|
|
|
def test_before_request_and_routing_errors(): |
|
|
|
app = flask.Flask(__name__) |
|
|
|
app = flask.Flask(__name__) |
|
|
|
|
|
|
|
|
|
|
|