(app, client)
| 78 | |
| 79 | |
| 80 | def test_blueprint_app_error_handling(app, client): |
| 81 | errors = flask.Blueprint(class="st">"errors", __name__) |
| 82 | |
| 83 | @errors.app_errorhandler(403) |
| 84 | def forbidden_handler(e): |
| 85 | return class="st">"you shall not pass", 403 |
| 86 | |
| 87 | @app.route(class="st">"/forbidden") |
| 88 | def app_forbidden(): |
| 89 | flask.abort(403) |
| 90 | |
| 91 | forbidden_bp = flask.Blueprint(class="st">"forbidden_bp", __name__) |
| 92 | |
| 93 | @forbidden_bp.route(class="st">"/nope") |
| 94 | def bp_forbidden(): |
| 95 | flask.abort(403) |
| 96 | |
| 97 | app.register_blueprint(errors) |
| 98 | app.register_blueprint(forbidden_bp) |
| 99 | |
| 100 | assert client.get(class="st">"/forbidden").data == bclass="st">"you shall not pass" |
| 101 | assert client.get(class="st">"/nope").data == bclass="st">"you shall not pass" |
| 102 | |
| 103 | |
| 104 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected