- Sort Score
- Result 10 results
- Languages All
Results 401 - 410 of 518 for testclient (0.06 sec)
-
tests/test_generate_unique_id_function.py
import warnings from fastapi import APIRouter, FastAPI from fastapi.routing import APIRoute from fastapi.testclient import TestClient from pydantic import BaseModel def custom_generate_unique_id(route: APIRoute): return f"foo_{route.name}" def custom_generate_unique_id2(route: APIRoute): return f"bar_{route.name}" def custom_generate_unique_id3(route: APIRoute): return f"baz_{route.name}"
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 66.7K bytes - Viewed (0) -
tests/test_form_default.py
from typing import Annotated, Optional from fastapi import FastAPI, File, Form from starlette.testclient import TestClient app = FastAPI() @app.post("/urlencoded") async def post_url_encoded(age: Annotated[Optional[int], Form()] = None): return age @app.post("/multipart") async def post_multi_part( age: Annotated[Optional[int], Form()] = None, file: Annotated[Optional[bytes], File()] = None, ):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 848 bytes - Viewed (0) -
tests/test_validation_error_context.py
from fastapi import FastAPI, Request, WebSocket from fastapi.exceptions import ( RequestValidationError, ResponseValidationError, WebSocketRequestValidationError, ) from fastapi.testclient import TestClient from pydantic import BaseModel class Item(BaseModel): id: int name: str class ExceptionCapture: def __init__(self): self.exception = None def capture(self, exc):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 06 12:21:57 UTC 2025 - 4.7K bytes - Viewed (0) -
tests/test_tutorial/test_behind_a_proxy/test_tutorial003.py
from fastapi.testclient import TestClient from inline_snapshot import snapshot from docs_src.behind_a_proxy.tutorial003_py39 import app client = TestClient(app) def test_main(): response = client.get("/app") assert response.status_code == 200 assert response.json() == {"message": "Hello World", "root_path": "/api/v1"} def test_openapi_schema(): response = client.get("/openapi.json")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 1.5K bytes - Viewed (0) -
tests/test_security_scopes_dont_propagate.py
# Ref: https://github.com/tiangolo/fastapi/issues/5623 from typing import Annotated, Any from fastapi import FastAPI, Security from fastapi.security import SecurityScopes from fastapi.testclient import TestClient async def security1(scopes: SecurityScopes): return scopes.scopes async def security2(scopes: SecurityScopes): return scopes.scopes async def dep3(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 973 bytes - Viewed (0) -
tests/test_tutorial/test_path_operation_configurations/test_tutorial002b.py
from fastapi.testclient import TestClient from docs_src.path_operation_configuration.tutorial002b_py39 import app client = TestClient(app) def test_get_items(): response = client.get("/items/") assert response.status_code == 200, response.text assert response.json() == ["Portal gun", "Plumbus"] def test_get_users(): response = client.get("/users/") 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 - 1.7K bytes - Viewed (0) -
tests/test_tutorial/test_path_operation_configurations/test_tutorial006.py
import pytest from fastapi.testclient import TestClient from docs_src.path_operation_configuration.tutorial006_py39 import app client = TestClient(app) @pytest.mark.parametrize( "path,expected_status,expected_response", [ ("/items/", 200, [{"name": "Foo", "price": 42}]), ("/users/", 200, [{"username": "johndoe"}]), ("/elements/", 200, [{"item_id": "Foo"}]), ], )
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 2.4K bytes - Viewed (0) -
tests/test_serialize_response_dataclass.py
from dataclasses import dataclass from datetime import datetime from typing import Optional from fastapi import FastAPI from fastapi.testclient import TestClient app = FastAPI() @dataclass class Item: name: str date: datetime price: Optional[float] = None owner_ids: Optional[list[int]] = None @app.get("/items/valid", response_model=Item) def get_valid():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 4.9K bytes - Viewed (0) -
tests/test_serialize_response_model.py
from typing import Optional from fastapi import FastAPI from pydantic import BaseModel, Field from starlette.testclient import TestClient app = FastAPI() class Item(BaseModel): name: str = Field(alias="aliased_name") price: Optional[float] = None owner_ids: Optional[list[int]] = None @app.get("/items/valid", response_model=Item) def get_valid(): return Item(aliased_name="valid", price=1.0)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 4.2K bytes - Viewed (0) -
tests/test_top_level_security_scheme_in_openapi.py
from fastapi import Depends, FastAPI from fastapi.security import HTTPBearer from fastapi.testclient import TestClient from inline_snapshot import snapshot app = FastAPI() bearer_scheme = HTTPBearer() @app.get("/", dependencies=[Depends(bearer_scheme)]) async def get_root(): return {"message": "Hello, World!"} client = TestClient(app) def test_get_root():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 24 19:03:06 UTC 2025 - 1.9K bytes - Viewed (0)