Home / Function/ test_url_mapping() — flask Function Reference

test_url_mapping() — flask Function Reference

Architecture documentation for the test_url_mapping() function in test_basic.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  2228ad46_ecce_ba14_d8b8_d36ec0c179d8["test_url_mapping()"]
  85bc4fb5_d1d7_a135_020d_69e052c12c0f["test_basic.py"]
  2228ad46_ecce_ba14_d8b8_d36ec0c179d8 -->|defined in| 85bc4fb5_d1d7_a135_020d_69e052c12c0f
  6ea1611d_2801_3cb5_a5b9_5b6403cc0537["index()"]
  2228ad46_ecce_ba14_d8b8_d36ec0c179d8 -->|calls| 6ea1611d_2801_3cb5_a5b9_5b6403cc0537
  style 2228ad46_ecce_ba14_d8b8_d36ec0c179d8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_basic.py lines 157–190

def test_url_mapping(app, client):
    random_uuid4 = "7eb41166-9ebf-4d26-b771-ea3f54f8b383"

    def index():
        return flask.request.method

    def more():
        return flask.request.method

    def options():
        return random_uuid4

    app.add_url_rule("/", "index", index)
    app.add_url_rule("/more", "more", more, methods=["GET", "POST"])

    # Issue 1288: Test that automatic options are not added
    #             when non-uppercase 'options' in methods
    app.add_url_rule("/options", "options", options, methods=["options"])

    assert client.get("/").data == b"GET"
    rv = client.post("/")
    assert rv.status_code == 405
    assert sorted(rv.allow) == ["GET", "HEAD", "OPTIONS"]
    rv = client.head("/")
    assert rv.status_code == 200
    assert not rv.data  # head truncates
    assert client.post("/more").data == b"POST"
    assert client.get("/more").data == b"GET"
    rv = client.delete("/more")
    assert rv.status_code == 405
    assert sorted(rv.allow) == ["GET", "HEAD", "OPTIONS", "POST"]
    rv = client.open("/options", method="OPTIONS")
    assert rv.status_code == 200
    assert random_uuid4 in rv.data.decode("utf-8")

Subdomains

Defined In

Calls

Frequently Asked Questions

What does test_url_mapping() do?
test_url_mapping() is a function in the flask codebase, defined in tests/test_basic.py.
Where is test_url_mapping() defined?
test_url_mapping() is defined in tests/test_basic.py at line 157.
What does test_url_mapping() call?
test_url_mapping() calls 1 function(s): index.

Analyze Your Own Codebase

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

Try Supermodel Free