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

Function test_app_add_route

tests/test_applications.py:356–369  ·  view source on GitHub ↗
(test_client_factory: TestClientFactory)

Source from the content-addressed store, hash-verified

354
355
356def test_app_add_route(test_client_factory: TestClientFactory) -> None:
357 async def homepage(request: Request) -> PlainTextResponse:
358 return PlainTextResponse("Hello, World!")
359
360 app = Starlette(
361 routes=[
362 Route("/", endpoint=homepage),
363 ]
364 )
365
366 client = test_client_factory(app)
367 response = client.get("/")
368 assert response.status_code == 200
369 assert response.text == "Hello, World!"
370
371
372def test_app_add_websocket_route(test_client_factory: TestClientFactory) -> None:

Callers

nothing calls this directly

Calls 4

StarletteClass · 0.90
RouteClass · 0.90
test_client_factoryFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected