Home / Function/ test_view_provide_automatic_options_attr() — flask Function Reference

test_view_provide_automatic_options_attr() — flask Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2299400f_43b0_e190_fbc9_77781c878586["test_view_provide_automatic_options_attr()"]
  dc72c3f0_27a2_eeb5_19d5_19d3385508ed["test_views.py"]
  2299400f_43b0_e190_fbc9_77781c878586 -->|defined in| dc72c3f0_27a2_eeb5_19d5_19d3385508ed
  c133540b_f6d4_d751_3d54_54f79e3eab17["dispatch_request()"]
  2299400f_43b0_e190_fbc9_77781c878586 -->|calls| c133540b_f6d4_d751_3d54_54f79e3eab17
  style 2299400f_43b0_e190_fbc9_77781c878586 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_views.py lines 101–138

def test_view_provide_automatic_options_attr():
    app = flask.Flask(__name__)

    class Index1(flask.views.View):
        provide_automatic_options = False

        def dispatch_request(self):
            return "Hello World!"

    app.add_url_rule("/", view_func=Index1.as_view("index"))
    c = app.test_client()
    rv = c.open("/", method="OPTIONS")
    assert rv.status_code == 405

    app = flask.Flask(__name__)

    class Index2(flask.views.View):
        methods = ["OPTIONS"]
        provide_automatic_options = True

        def dispatch_request(self):
            return "Hello World!"

    app.add_url_rule("/", view_func=Index2.as_view("index"))
    c = app.test_client()
    rv = c.open("/", method="OPTIONS")
    assert sorted(rv.allow) == ["OPTIONS"]

    app = flask.Flask(__name__)

    class Index3(flask.views.View):
        def dispatch_request(self):
            return "Hello World!"

    app.add_url_rule("/", view_func=Index3.as_view("index"))
    c = app.test_client()
    rv = c.open("/", method="OPTIONS")
    assert "OPTIONS" in rv.allow

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free