Home / Function/ test_blueprint_with_subdomain() — flask Function Reference

test_blueprint_with_subdomain() — flask Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/test_testing.py lines 117–138

def test_blueprint_with_subdomain():
    app = flask.Flask(__name__, subdomain_matching=True)
    app.config["SERVER_NAME"] = "example.com:1234"
    app.config["APPLICATION_ROOT"] = "/foo"
    client = app.test_client()

    bp = flask.Blueprint("company", __name__, subdomain="xxx")

    @bp.route("/")
    def index():
        return flask.request.url

    app.register_blueprint(bp)

    ctx = app.test_request_context("/", subdomain="xxx")
    assert ctx.request.url == "http://xxx.example.com:1234/foo/"

    with ctx:
        assert ctx.request.blueprint == bp.name

    rv = client.get("/", subdomain="xxx")
    assert rv.data == b"http://xxx.example.com:1234/foo/"

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free