Browse Source

Add test for `docs_src.dependencies.tutorial001_02.py`

pull/14569/head
Yurii Motov 7 months ago
parent
commit
94aa386bcd
  1. 36
      tests/test_tutorial/test_dependencies/test_tutorial001_tutorial001_02.py

36
tests/test_tutorial/test_dependencies/test_tutorial001.py → tests/test_tutorial/test_dependencies/test_tutorial001_tutorial001_02.py

@ -1,10 +1,11 @@
import importlib import importlib
import pytest import pytest
from dirty_equals import IsDict
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
from ...utils import needs_py39, needs_py310 from ...utils import needs_py39, needs_py310, needs_pydanticv2
skip_for_pydantic_v1 = needs_pydanticv2
@pytest.fixture( @pytest.fixture(
@ -15,6 +16,9 @@ from ...utils import needs_py39, needs_py310
"tutorial001_an", "tutorial001_an",
pytest.param("tutorial001_an_py39", marks=needs_py39), pytest.param("tutorial001_an_py39", marks=needs_py39),
pytest.param("tutorial001_an_py310", marks=needs_py310), pytest.param("tutorial001_an_py310", marks=needs_py310),
"tutorial001_02_an",
pytest.param("tutorial001_02_an_py39", marks=needs_py39),
pytest.param("tutorial001_02_an_py310", marks=needs_py310),
], ],
) )
def get_client(request: pytest.FixtureRequest): def get_client(request: pytest.FixtureRequest):
@ -70,16 +74,10 @@ def test_openapi_schema(client: TestClient):
"parameters": [ "parameters": [
{ {
"required": False, "required": False,
"schema": IsDict( "schema": {
{ "anyOf": [{"type": "string"}, {"type": "null"}],
"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Q",
"title": "Q", },
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{"title": "Q", "type": "string"}
),
"name": "q", "name": "q",
"in": "query", "in": "query",
}, },
@ -129,16 +127,10 @@ def test_openapi_schema(client: TestClient):
"parameters": [ "parameters": [
{ {
"required": False, "required": False,
"schema": IsDict( "schema": {
{ "anyOf": [{"type": "string"}, {"type": "null"}],
"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Q",
"title": "Q", },
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{"title": "Q", "type": "string"}
),
"name": "q", "name": "q",
"in": "query", "in": "query",
}, },
Loading…
Cancel
Save