Debian Codegraph @

examples/api/tests/test_api.py

raw
1 from api import app
2 from api import TodoIn
3
4
5 async def test_echo() -> None:
6 test_client = app.test_client()
7 response = await test_client.post("/echo", json={"a": "b"})
8 data = await response.get_json()
9 assert data == {"extra": True, "input": {"a": "b"}}
10
11
12 async def test_create_todo() -> None:
13 test_client = app.test_client()
14 response = await test_client.post("/todos/", json=TodoIn(task="Abc", due=None))
15 data = await response.get_json()
16 assert data == {"id": 1, "task": "Abc", "due": None}