Home / Function/ test_app_request_processing() — flask Function Reference

test_app_request_processing() — flask Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/test_blueprints.py lines 808–844

def test_app_request_processing(app, client):
    bp = flask.Blueprint("bp", __name__)
    evts = []

    @bp.before_app_request
    def before_app():
        evts.append("before")

    @bp.after_app_request
    def after_app(response):
        response.data += b"|after"
        evts.append("after")
        return response

    @bp.teardown_app_request
    def teardown_app(exc):
        evts.append("teardown")

    app.register_blueprint(bp)

    # Setup routes for testing
    @app.route("/")
    def bp_endpoint():
        return "request"

    # before first request
    assert evts == []

    # first request
    resp = client.get("/").data
    assert resp == b"request|after"
    assert evts == ["before", "after", "teardown"]

    # second request
    resp = client.get("/").data
    assert resp == b"request|after"
    assert evts == ["before", "after", "teardown"] * 2

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free