MCPcopy
hub / github.com/encode/starlette / test_host_reverse_urls

Function test_host_reverse_urls

tests/test_routing.py:479–493  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

477
478
479def test_host_reverse_urls() -> None:
480 assert mixed_hosts_app.url_path_for("homepage").make_absolute_url("https://whatever") == "https://www.example.org/"
481 assert (
482 mixed_hosts_app.url_path_for("users").make_absolute_url("https://whatever") == "https://www.example.org/users"
483 )
484 assert (
485 mixed_hosts_app.url_path_for("api:users").make_absolute_url("https://whatever")
486 == "https://api.example.org/users"
487 )
488 assert (
489 mixed_hosts_app.url_path_for("port:homepage").make_absolute_url("https://whatever")
490 == "https://port.example.org:3600/"
491 )
492 with pytest.raises(NoMatchFound):
493 mixed_hosts_app.url_path_for("api", path="whatever", foo="bar")
494
495
496async def subdomain_app(scope: Scope, receive: Receive, send: Send) -> None:

Callers

nothing calls this directly

Calls 2

make_absolute_urlMethod · 0.80
url_path_forMethod · 0.45

Tested by

no test coverage detected