(test_client_factory: TestClientFactory)
| 181 | |
| 182 | |
| 183 | def test_request_json(test_client_factory: TestClientFactory) -> None: |
| 184 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 185 | request = Request(scope, receive) |
| 186 | data = await request.json() |
| 187 | response = JSONResponse({"json": data}) |
| 188 | await response(scope, receive, send) |
| 189 | |
| 190 | client = test_client_factory(app) |
| 191 | response = client.post("/", json={"a": "123"}) |
| 192 | assert response.json() == {"json": {"a": "123"}} |
| 193 | |
| 194 | |
| 195 | def test_request_scope_interface() -> None: |
nothing calls this directly
no test coverage detected