- Sort Score
- Result 10 results
- Languages All
Results 151 - 160 of 518 for testclient (0.1 sec)
-
tests/test_additional_responses_response_class.py
from fastapi import FastAPI from fastapi.responses import JSONResponse from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class JsonApiResponse(JSONResponse): media_type = "application/vnd.api+json" class Error(BaseModel): status: str title: str class JsonApiError(BaseModel): errors: list[Error] @app.get( "/a",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 3.5K bytes - Viewed (0) -
tests/test_starlette_urlconvertors.py
from fastapi import FastAPI, Path, Query from fastapi.testclient import TestClient app = FastAPI() @app.get("/int/{param:int}") def int_convertor(param: int = Path()): return {"int": param} @app.get("/float/{param:float}") def float_convertor(param: float = Path()): return {"float": param} @app.get("/path/{param:path}") def path_convertor(param: str = Path()): return {"path": param}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Nov 27 14:46:06 UTC 2022 - 1.7K bytes - Viewed (0) -
tests/test_tutorial/test_path_params/test_tutorial002.py
from fastapi.testclient import TestClient from docs_src.path_params.tutorial002_py39 import app client = TestClient(app) def test_get_items(): response = client.get("/items/1") assert response.status_code == 200, response.text assert response.json() == {"item_id": 1} def test_get_items_invalid_id(): response = client.get("/items/item1") assert response.status_code == 422, response.text
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 4.2K bytes - Viewed (0) -
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial001.py
import importlib import pytest from fastapi.testclient import TestClient from ...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: Fri Dec 26 10:43:02 UTC 2025 - 5.6K bytes - Viewed (0) -
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py
import importlib import pytest from fastapi.testclient import TestClient from ...utils import needs_py310 @pytest.fixture( name="client", params=[ pytest.param("tutorial001_py39"), pytest.param("tutorial001_py310", marks=needs_py310), ], ) def get_client(request: pytest.FixtureRequest) -> TestClient: mod = importlib.import_module(f"docs_src.separate_openapi_schemas.{request.param}")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 5K bytes - Viewed (0) -
tests/test_tutorial/test_templates/test_tutorial001.py
import os import shutil from fastapi.testclient import TestClient def test_main(): if os.path.isdir("./static"): # pragma: nocover shutil.rmtree("./static") if os.path.isdir("./templates"): # pragma: nocover shutil.rmtree("./templates") shutil.copytree("./docs_src/templates/templates/", "./templates") shutil.copytree("./docs_src/templates/static/", "./static")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 915 bytes - Viewed (0) -
tests/test_tutorial/test_advanced_middleware/test_tutorial002.py
from fastapi.testclient import TestClient from docs_src.advanced_middleware.tutorial002_py39 import app def test_middleware(): client = TestClient(app, base_url="http://example.com") response = client.get("/") assert response.status_code == 200, response.text client = TestClient(app, base_url="http://subdomain.example.com") response = client.get("/") assert response.status_code == 200, response.text
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 575 bytes - Viewed (0) -
tests/test_request_params/test_body/test_required_str.py
from typing import Annotated, Any, Union import pytest from dirty_equals import IsOneOf from fastapi import Body, FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, Field from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases @app.post("/required-str", operation_id="required_str")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 11K bytes - Viewed (0) -
tests/test_request_params/test_file/test_optional_list.py
from typing import Annotated, Optional import pytest from fastapi import FastAPI, File, UploadFile from fastapi.testclient import TestClient from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases @app.post("/optional-list-bytes") async def read_optional_list_bytes(p: Annotated[Optional[list[bytes]], File()] = None):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10.4K bytes - Viewed (0) -
tests/test_tutorial/test_settings/test_app01.py
import importlib import sys import pytest from dirty_equals import IsAnyStr from fastapi.testclient import TestClient from pydantic import ValidationError from pytest import MonkeyPatch @pytest.fixture( name="mod_name", params=[ pytest.param("app01_py39"), ], ) def get_mod_name(request: pytest.FixtureRequest): return f"docs_src.settings.{request.param}.main" @pytest.fixture(name="client")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 2.2K bytes - Viewed (0)