Fix subdomain inheritance for nested blueprints.

Fixes #4834
This commit is contained in:
Josh Michael Karamuth 2022-10-26 14:22:00 +04:00
parent 3dc6db9d0c
commit 8368872ccd
3 changed files with 32 additions and 0 deletions

View file

@ -950,6 +950,27 @@ def test_nesting_url_prefixes(
assert response.status_code == 200
def test_nesting_subdomains(app, client) -> None:
subdomain = "api"
parent = flask.Blueprint("parent", __name__)
child = flask.Blueprint("child", __name__)
@child.route("/child/")
def index():
return "child"
parent.register_blueprint(child)
app.register_blueprint(parent, subdomain=subdomain)
client.allow_subdomain_redirects = True
domain_name = "domain.tld"
app.config["SERVER_NAME"] = domain_name
response = client.get("/child/", base_url="http://api." + domain_name)
assert response.status_code == 200
def test_unique_blueprint_names(app, client) -> None:
bp = flask.Blueprint("bp", __name__)
bp2 = flask.Blueprint("bp", __name__)