Home / Function/ test_blueprint_app_error_handling() — flask Function Reference

test_blueprint_app_error_handling() — flask Function Reference

Architecture documentation for the test_blueprint_app_error_handling() function in test_blueprints.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  3833c954_71b7_4be1_3e81_aa37afa52c32["test_blueprint_app_error_handling()"]
  4366a441_d387_52f9_ec8d_1c41c71c00a8["test_blueprints.py"]
  3833c954_71b7_4be1_3e81_aa37afa52c32 -->|defined in| 4366a441_d387_52f9_ec8d_1c41c71c00a8
  style 3833c954_71b7_4be1_3e81_aa37afa52c32 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_blueprints.py lines 80–101

def test_blueprint_app_error_handling(app, client):
    errors = flask.Blueprint("errors", __name__)

    @errors.app_errorhandler(403)
    def forbidden_handler(e):
        return "you shall not pass", 403

    @app.route("/forbidden")
    def app_forbidden():
        flask.abort(403)

    forbidden_bp = flask.Blueprint("forbidden_bp", __name__)

    @forbidden_bp.route("/nope")
    def bp_forbidden():
        flask.abort(403)

    app.register_blueprint(errors)
    app.register_blueprint(forbidden_bp)

    assert client.get("/forbidden").data == b"you shall not pass"
    assert client.get("/nope").data == b"you shall not pass"

Subdomains

Frequently Asked Questions

What does test_blueprint_app_error_handling() do?
test_blueprint_app_error_handling() is a function in the flask codebase, defined in tests/test_blueprints.py.
Where is test_blueprint_app_error_handling() defined?
test_blueprint_app_error_handling() is defined in tests/test_blueprints.py at line 80.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free