automatic options as separate route

This commit is contained in:
David Lord 2026-02-12 13:59:15 -08:00
parent dcbede0cb0
commit 80669a0ea8
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
5 changed files with 56 additions and 30 deletions

View file

@ -52,6 +52,13 @@ def test_options_on_multiple_rules(app, client):
assert sorted(rv.allow) == ["GET", "HEAD", "OPTIONS", "POST", "PUT"]
def test_options_view_args(app: flask.Flask, client: FlaskClient) -> None:
"""The automatic options view accepts any view args."""
app.add_url_rule("/<a>/<b>", endpoint="add")
rv = client.options("/1/2")
assert rv.allow == {"GET", "HEAD", "OPTIONS"}
@pytest.mark.parametrize("method", ["get", "post", "put", "delete", "patch"])
def test_method_route(app, client, method):
method_route = getattr(app, method)