Ensure that blueprint subdomains suffix-chain

This ensures that a child's subdomain prefixs any parent subdomain
such that the full domain is child.parent.domain.tld and onwards with
further nesting. This makes the most sense to users and mimics how
url_prefixes work (although subdomains suffix).
This commit is contained in:
pgjones 2023-01-04 16:45:20 +00:00
parent d7b6c1f670
commit cabda59353
4 changed files with 26 additions and 4 deletions

View file

@ -971,7 +971,7 @@ def test_nesting_subdomains(app, client) -> None:
assert response.status_code == 200
def test_child_overrides_parent_subdomain(app, client) -> None:
def test_child_and_parent_subdomain(app, client) -> None:
child_subdomain = "api"
parent_subdomain = "parent"
parent = flask.Blueprint("parent", __name__)
@ -988,7 +988,9 @@ def test_child_overrides_parent_subdomain(app, client) -> None:
domain_name = "domain.tld"
app.config["SERVER_NAME"] = domain_name
response = client.get("/", base_url=f"http://{child_subdomain}.{domain_name}")
response = client.get(
"/", base_url=f"http://{child_subdomain}.{parent_subdomain}.{domain_name}"
)
assert response.status_code == 200