Debian Codegraph @

docs/examples/onboarding/flask/test_handler.py

raw
1 from litestar import get
2 from litestar.status_codes import HTTP_200_OK
3 from litestar.testing import create_test_client
4
5
6 @get("/", sync_to_thread=False)
7 def index() -> str:
8 return "Index Page"
9
10
11 def test_index() -> None:
12 with create_test_client(route_handlers=[index]) as client:
13 response = client.get("/")
14 assert response.status_code == HTTP_200_OK
15 assert response.text == "Index Page"