MCPcopy Create free account
hub / github.com/pallets/flask / test_provide_automatic_options_attr

Function test_provide_automatic_options_attr

tests/test_basic.py:70–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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