4 changed files with 19 additions and 29 deletions
@ -1,33 +1,21 @@ |
|||||
import pytest |
import pytest |
||||
from dirty_equals import IsDict |
|
||||
from fastapi.testclient import TestClient |
from fastapi.testclient import TestClient |
||||
from fastapi.utils import match_pydantic_error_url |
|
||||
|
|
||||
|
|
||||
@pytest.fixture(name="client") |
@pytest.fixture(name="client") |
||||
def get_client(): |
def get_client(): |
||||
from docs_src.query_params.tutorial006 import app |
from docs_src.query_params.tutorial007_py310 import app |
||||
|
|
||||
c = TestClient(app) |
c = TestClient(app) |
||||
return c |
return c |
||||
|
|
||||
|
|
||||
def test_foo_needy_very(client: TestClient): |
def test_foo_needy_very(client: TestClient): |
||||
response = client.get("/items/foo?needy=very") |
response = client.get("/query/mixed-type-params?query=1&query=2&foo=bar&foo=baz") |
||||
assert response.status_code == 200 |
assert response.status_code == 200 |
||||
assert response.json() == { |
assert response.json() == { |
||||
"query": 1, |
"query": 2, |
||||
"string_mapping": { |
"string_mapping": {"query": "2", "foo": "baz"}, |
||||
"query": "1", |
"mapping_query_int": {"query": 2}, |
||||
"foo": "baz" |
"sequence_mapping_queries": {"query": [1, 2], "foo": []}, |
||||
}, |
} |
||||
"mapping_query_int": { |
|
||||
"query": 1 |
|
||||
}, |
|
||||
"sequence_mapping_queries": { |
|
||||
"query": [ |
|
||||
"1" |
|
||||
], |
|
||||
"foo": [] |
|
||||
} |
|
||||
} |
|
||||
|
|||||
Loading…
Reference in new issue