Home / Function/ test_static_route_with_host_matching() — flask Function Reference

test_static_route_with_host_matching() — flask Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e16b089b_96d7_290f_fbab_ef193f4c7614["test_static_route_with_host_matching()"]
  85bc4fb5_d1d7_a135_020d_69e052c12c0f["test_basic.py"]
  e16b089b_96d7_290f_fbab_ef193f4c7614 -->|defined in| 85bc4fb5_d1d7_a135_020d_69e052c12c0f
  style e16b089b_96d7_290f_fbab_ef193f4c7614 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_basic.py lines 1468–1486

def test_static_route_with_host_matching():
    app = flask.Flask(__name__, host_matching=True, static_host="example.com")
    c = app.test_client()
    rv = c.get("http://example.com/static/index.html")
    assert rv.status_code == 200
    rv.close()
    with app.test_request_context():
        rv = flask.url_for("static", filename="index.html", _external=True)
        assert rv == "http://example.com/static/index.html"
    # Providing static_host without host_matching=True should error.
    with pytest.raises(AssertionError):
        flask.Flask(__name__, static_host="example.com")
    # Providing host_matching=True with static_folder
    # but without static_host should error.
    with pytest.raises(AssertionError):
        flask.Flask(__name__, host_matching=True)
    # Providing host_matching=True without static_host
    # but with static_folder=None should not error.
    flask.Flask(__name__, host_matching=True, static_folder=None)

Subdomains

Defined In

Frequently Asked Questions

What does test_static_route_with_host_matching() do?
test_static_route_with_host_matching() is a function in the flask codebase, defined in tests/test_basic.py.
Where is test_static_route_with_host_matching() defined?
test_static_route_with_host_matching() is defined in tests/test_basic.py at line 1468.

Analyze Your Own Codebase

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

Try Supermodel Free