MCPcopy Create free account
hub / github.com/pallets/flask / test_error_handler_after_processor_error

Function test_error_handler_after_processor_error

tests/test_basic.py:1071–1097  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

1069
1070
1071def test_error_handler_after_processor_error(app, client):
1072 app.testing = False
1073
1074 @app.before_request
1075 def before_request():
1076 if _trigger == "before":
1077 raise ZeroDivisionError
1078
1079 @app.after_request
1080 def after_request(response):
1081 if _trigger == "after":
1082 raise ZeroDivisionError
1083
1084 return response
1085
1086 @app.route("/")
1087 def index():
1088 return "Foo"
1089
1090 @app.errorhandler(500)
1091 def internal_server_error(e):
1092 return "Hello Server Error", 500
1093
1094 for _trigger in "before", "after":
1095 rv = client.get("/")
1096 assert rv.status_code == 500
1097 assert rv.data == b"Hello Server Error"
1098
1099
1100def test_enctype_debug_helper(app, client):

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected