Debian Codegraph @

docs/examples/onboarding/django/test_handler.py

raw
1 from typing import Dict
2
3 from litestar import get
4 from litestar.status_codes import HTTP_200_OK
5 from litestar.testing import create_test_client
6
7
8 @get("/")
9 async def hello() -> Dict[str, str]:
10 return {"hello": "world"}
11
12
13 def test_hello() -> None:
14 with create_test_client(route_handlers=[hello]) as client:
15 response = client.get("/")
16 assert response.status_code == HTTP_200_OK
17 assert response.json() == {"hello": "world"}