MCPcopy
hub / github.com/pallets/flask / test_provide_automatic_options_attr

Function test_provide_automatic_options_attr

tests/test_basic.py:72–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70
71
72def test_provide_automatic_options_attr():
73 app = flask.Flask(__name__)
74
75 def index():
76 return "Hello World!"
77
78 index.provide_automatic_options = False
79 app.route("/")(index)
80 rv = app.test_client().open("/", method="OPTIONS")
81 assert rv.status_code == 405
82
83 app = flask.Flask(__name__)
84
85 def index2():
86 return "Hello World!"
87
88 index2.provide_automatic_options = True
89 app.route("/", methods=["OPTIONS"])(index2)
90 rv = app.test_client().open("/", method="OPTIONS")
91 assert sorted(rv.allow) == ["OPTIONS"]
92
93
94def test_provide_automatic_options_kwarg(app, client):

Callers

nothing calls this directly

Calls 3

test_clientMethod · 0.95
routeMethod · 0.80
openMethod · 0.80

Tested by

no test coverage detected