(app)
| 134 | |
| 135 | |
| 136 | def test_error_handler_blueprint(app): |
| 137 | bp = flask.Blueprint("bp", __name__) |
| 138 | |
| 139 | @bp.errorhandler(500) |
| 140 | def bp_exception_handler(e): |
| 141 | return "bp-error" |
| 142 | |
| 143 | @bp.route("/error") |
| 144 | def bp_test(): |
| 145 | raise InternalServerError() |
| 146 | |
| 147 | @app.errorhandler(500) |
| 148 | def app_exception_handler(e): |
| 149 | return "app-error" |
| 150 | |
| 151 | @app.route("/error") |
| 152 | def app_test(): |
| 153 | raise InternalServerError() |
| 154 | |
| 155 | app.register_blueprint(bp, url_prefix="/bp") |
| 156 | |
| 157 | c = app.test_client() |
| 158 | |
| 159 | assert c.get("/error").data == b"app-error" |
| 160 | assert c.get("/bp/error").data == b"bp-error" |
| 161 | |
| 162 | |
| 163 | def test_default_error_handler(): |
nothing calls this directly
no test coverage detected