Home / Function/ test_view_decorators() — flask Function Reference

test_view_decorators() — flask Function Reference

Architecture documentation for the test_view_decorators() function in test_views.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  b7d1929f_2f9c_6380_a721_5688de4ae510["test_view_decorators()"]
  2c28d548_0608_4e60_2810_9b6166cb0f85["test_views.py"]
  b7d1929f_2f9c_6380_a721_5688de4ae510 -->|defined in| 2c28d548_0608_4e60_2810_9b6166cb0f85
  d817c000_13fd_a384_a795_e9cfdfc27db2["get()"]
  b7d1929f_2f9c_6380_a721_5688de4ae510 -->|calls| d817c000_13fd_a384_a795_e9cfdfc27db2
  3be36d36_e1d6_9d44_d642_ded77d204984["dispatch_request()"]
  b7d1929f_2f9c_6380_a721_5688de4ae510 -->|calls| 3be36d36_e1d6_9d44_d642_ded77d204984
  style b7d1929f_2f9c_6380_a721_5688de4ae510 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_views.py lines 80–98

def test_view_decorators(app, client):
    def add_x_parachute(f):
        def new_function(*args, **kwargs):
            resp = flask.make_response(f(*args, **kwargs))
            resp.headers["X-Parachute"] = "awesome"
            return resp

        return new_function

    class Index(flask.views.View):
        decorators = [add_x_parachute]

        def dispatch_request(self):
            return "Awesome"

    app.add_url_rule("/", view_func=Index.as_view("index"))
    rv = client.get("/")
    assert rv.headers["X-Parachute"] == "awesome"
    assert rv.data == b"Awesome"

Subdomains

Defined In

Frequently Asked Questions

What does test_view_decorators() do?
test_view_decorators() is a function in the flask codebase, defined in tests/test_views.py.
Where is test_view_decorators() defined?
test_view_decorators() is defined in tests/test_views.py at line 80.
What does test_view_decorators() call?
test_view_decorators() calls 2 function(s): dispatch_request, get.

Analyze Your Own Codebase

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

Try Supermodel Free