- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 112 for testclient (0.04 sec)
-
tests/test_tutorial/test_body/test_tutorial001.py
import importlib from unittest.mock import patch import pytest from fastapi.testclient import TestClient from ...utils import needs_py310 @pytest.fixture( name="client", params=[ "tutorial001_py39", pytest.param("tutorial001_py310", marks=needs_py310), ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.body.{request.param}")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10.6K bytes - Viewed (0) -
tests/test_request_params/test_cookie/test_optional_str.py
from typing import Annotated, Optional import pytest from fastapi import Cookie, FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-str") async def read_optional_str(p: Annotated[Optional[str], Cookie()] = None): return {"p": p}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 8.4K bytes - Viewed (0) -
tests/test_request_params/test_header/test_optional_list.py
from typing import Annotated, Optional import pytest from fastapi import FastAPI, Header from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-list-str") async def read_optional_list_str( p: Annotated[Optional[list[str]], Header()] = None, ):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 9.3K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial001_02.py
client = TestClient(mod.app) return client def test_post_form_no_body(client: TestClient): response = client.post("/files/") assert response.status_code == 200, response.text assert response.json() == {"message": "No file sent"} def test_post_uploadfile_no_body(client: TestClient): response = client.post("/uploadfile/")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 7.4K bytes - Viewed (0) -
tests/test_tutorial/test_custom_request_and_route/test_tutorial002.py
mod = importlib.import_module(f"docs_src.custom_request_and_route.{request.param}") client = TestClient(mod.app) return client def test_endpoint_works(client: TestClient): response = client.post("/", json=[1, 2, 3]) assert response.json() == 6 def test_exception_handler_body_access(client: TestClient): response = client.post("/", json={"numbers": [1, 2, 3]}) assert response.json() == {
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 1.3K bytes - Viewed (0) -
tests/test_request_params/test_query/test_list.py
from typing import Annotated import pytest from dirty_equals import IsOneOf from fastapi import FastAPI, Query from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/required-list-str") async def read_required_list_str(p: Annotated[list[str], Query()]): return {"p": p}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:31:34 UTC 2025 - 10.9K bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial006.py
import importlib import pytest from fastapi.testclient import TestClient @pytest.fixture( name="client", params=[ pytest.param("tutorial006_py39"), pytest.param("tutorial006_an_py39"), ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.dependencies.{request.param}") client = TestClient(mod.app) return client
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 4.8K bytes - Viewed (0) -
tests/test_tutorial/test_header_param_models/test_tutorial001.py
import importlib import pytest from fastapi.testclient import TestClient from inline_snapshot import snapshot from tests.utils import needs_py310 @pytest.fixture( name="client", params=[ pytest.param("tutorial001_py39"), pytest.param("tutorial001_py310", marks=needs_py310), pytest.param("tutorial001_an_py39"), pytest.param("tutorial001_an_py310", marks=needs_py310), ], )
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 7.3K bytes - Viewed (0) -
tests/test_tutorial/test_body_multiple_params/test_tutorial003.py
import importlib import pytest from fastapi.testclient import TestClient from ...utils import needs_py310 @pytest.fixture( name="client", params=[ "tutorial003_py39", pytest.param("tutorial003_py310", marks=needs_py310), "tutorial003_an_py39", pytest.param("tutorial003_an_py310", marks=needs_py310), ], ) def get_client(request: pytest.FixtureRequest):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 7.4K bytes - Viewed (0) -
tests/test_request_params/test_form/test_optional_list.py
from typing import Annotated, Optional import pytest from fastapi import FastAPI, Form from fastapi.testclient import TestClient from pydantic import BaseModel, Field from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases @app.post("/optional-list-str", operation_id="optional_list_str") async def read_optional_list_str(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 9.9K bytes - Viewed (0)