test_server_name_subdomain() — flask Function Reference
Architecture documentation for the test_server_name_subdomain() function in test_basic.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 29f360d9_08c4_829a_091e_fcad8162be13["test_server_name_subdomain()"] 85bc4fb5_d1d7_a135_020d_69e052c12c0f["test_basic.py"] 29f360d9_08c4_829a_091e_fcad8162be13 -->|defined in| 85bc4fb5_d1d7_a135_020d_69e052c12c0f 6ea1611d_2801_3cb5_a5b9_5b6403cc0537["index()"] 29f360d9_08c4_829a_091e_fcad8162be13 -->|calls| 6ea1611d_2801_3cb5_a5b9_5b6403cc0537 style 29f360d9_08c4_829a_091e_fcad8162be13 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_basic.py lines 1541–1583
def test_server_name_subdomain():
app = flask.Flask(__name__, subdomain_matching=True)
client = app.test_client()
@app.route("/")
def index():
return "default"
@app.route("/", subdomain="foo")
def subdomain():
return "subdomain"
app.config["SERVER_NAME"] = "dev.local:5000"
rv = client.get("/")
assert rv.data == b"default"
rv = client.get("/", "http://dev.local:5000")
assert rv.data == b"default"
rv = client.get("/", "https://dev.local:5000")
assert rv.data == b"default"
app.config["SERVER_NAME"] = "dev.local:443"
rv = client.get("/", "https://dev.local")
# Werkzeug 1.0 fixes matching https scheme with 443 port
if rv.status_code != 404:
assert rv.data == b"default"
app.config["SERVER_NAME"] = "dev.local"
rv = client.get("/", "https://dev.local")
assert rv.data == b"default"
with pytest.warns(match="Current server name"):
rv = client.get("/", "http://foo.localhost")
if werkzeug_3_2:
assert rv.status_code == 200
else:
assert rv.status_code == 404
rv = client.get("/", "http://foo.dev.local")
assert rv.data == b"subdomain"
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does test_server_name_subdomain() do?
test_server_name_subdomain() is a function in the flask codebase, defined in tests/test_basic.py.
Where is test_server_name_subdomain() defined?
test_server_name_subdomain() is defined in tests/test_basic.py at line 1541.
What does test_server_name_subdomain() call?
test_server_name_subdomain() 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