Home / Function/ test_subdomain() — flask Function Reference

test_subdomain() — flask Function Reference

Architecture documentation for the test_subdomain() function in test_testing.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  101dec31_e867_ef72_6e8b_039896d45695["test_subdomain()"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0["test_testing.py"]
  101dec31_e867_ef72_6e8b_039896d45695 -->|defined in| 8c162ff0_0a8a_d943_77b6_c07b38d297a0
  style 101dec31_e867_ef72_6e8b_039896d45695 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_testing.py lines 291–307

def test_subdomain():
    app = flask.Flask(__name__, subdomain_matching=True)
    app.config["SERVER_NAME"] = "example.com"
    client = app.test_client()

    @app.route("/", subdomain="<company_id>")
    def view(company_id):
        return company_id

    with app.test_request_context():
        url = flask.url_for("view", company_id="xxx")

    with client:
        response = client.get(url)

    assert 200 == response.status_code
    assert b"xxx" == response.data

Subdomains

Frequently Asked Questions

What does test_subdomain() do?
test_subdomain() is a function in the flask codebase, defined in tests/test_testing.py.
Where is test_subdomain() defined?
test_subdomain() is defined in tests/test_testing.py at line 291.

Analyze Your Own Codebase

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

Try Supermodel Free