From 8ed6348f1ae824a992cc9e61a1e7cdae874da800 Mon Sep 17 00:00:00 2001 From: Roberto Prevato Date: Sun, 19 Nov 2023 10:33:30 +0100 Subject: [PATCH] Update testing.md --- docs/testing.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/docs/testing.md b/docs/testing.md index 76351b5..0c0bf6b 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -377,20 +377,10 @@ Finally, define a first test for the TODOs API: ```python # ./tests/test_todos_api.py -from typing import Any - import pytest -from blacksheep.contents import Content +from blacksheep.contents import JSONContent from blacksheep.testing import TestClient from domain import CreateToDoInput, ToDo -from essentials.json import dumps - - -def json_content(data: Any) -> Content: - return Content( - b"application/json", - dumps(data, separators=(",", ":")).encode("utf8"), - ) @pytest.mark.asyncio @@ -403,7 +393,7 @@ async def test_create_and_get_todo(test_client: TestClient) -> None: response = await test_client.post( "/api/todos", - content=json_content(create_input), + content=JSONContent(create_input), ) assert response is not None