From 3ee26432faa269338901e3609592b194a7748858 Mon Sep 17 00:00:00 2001 From: JONEMI19 Date: Sat, 8 Jul 2023 10:28:15 +0000 Subject: [PATCH] add tutorial test --- .../test_tutorial007_py310.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/test_tutorial/test_query_params/test_tutorial007_py310.py diff --git a/tests/test_tutorial/test_query_params/test_tutorial007_py310.py b/tests/test_tutorial/test_query_params/test_tutorial007_py310.py new file mode 100644 index 000000000..169742f8f --- /dev/null +++ b/tests/test_tutorial/test_query_params/test_tutorial007_py310.py @@ -0,0 +1,33 @@ +import pytest +from dirty_equals import IsDict +from fastapi.testclient import TestClient +from fastapi.utils import match_pydantic_error_url + + +@pytest.fixture(name="client") +def get_client(): + from docs_src.query_params.tutorial006 import app + + c = TestClient(app) + return c + + +def test_foo_needy_very(client: TestClient): + response = client.get("/items/foo?needy=very") + assert response.status_code == 200 + assert response.json() == { + "query": 1, + "string_mapping": { + "query": "1", + "foo": "baz" + }, + "mapping_query_int": { + "query": 1 + }, + "sequence_mapping_queries": { + "query": [ + "1" + ], + "foo": [] + } + } \ No newline at end of file