- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 509 for testclient (0.07 sec)
-
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_tutorial/test_response_directly/test_tutorial002.py
import pytest from fastapi.testclient import TestClient @pytest.fixture( name="client", params=[ pytest.param("tutorial002_py39"), ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.response_directly.{request.param}") client = TestClient(mod.app) return client def test_path_operation(client: TestClient):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 1.7K 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_websockets/test_tutorial003.py
@pytest.fixture(name="client") def get_client(mod: ModuleType): client = TestClient(mod.app) return client def test_get(client: TestClient, html: str): response = client.get("/") assert response.text == html def test_websocket_handle_disconnection(client: TestClient): with ( client.websocket_connect("/ws/1234") as connection, client.websocket_connect("/ws/5678") as connection_two,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 1.3K bytes - Viewed (0) -
tests/test_tutorial/test_request_form_models/test_tutorial002.py
import pytest from fastapi.testclient import TestClient @pytest.fixture( name="client", params=[ "tutorial002_py39", "tutorial002_an_py39", ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.request_form_models.{request.param}") client = TestClient(mod.app) return client def test_post_body_form(client: TestClient):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 6.2K bytes - Viewed (0) -
tests/test_tutorial/test_custom_docs_ui/test_tutorial002.py
import os from pathlib import Path import pytest from fastapi.testclient import TestClient @pytest.fixture(scope="module") def client(): static_dir: Path = Path(os.getcwd()) / "static" print(static_dir) static_dir.mkdir(exist_ok=True) from docs_src.custom_docs_ui.tutorial002_py39 import app with TestClient(app) as client: yield client static_dir.rmdir()
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 1.2K bytes - Viewed (0) -
tests/test_tutorial/test_security/test_tutorial006.py
from base64 import b64encode 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.security.{request.param}") client = TestClient(mod.app) return client
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 2.6K bytes - Viewed (0) -
docs/es/docs/tutorial/testing.md
Esto te permite usar `pytest` directamente sin complicaciones. /// /// note | Nota Técnica También podrías usar `from starlette.testclient import TestClient`. **FastAPI** proporciona el mismo `starlette.testclient` como `fastapi.testclient` solo por conveniencia para ti, el desarrollador. Pero proviene directamente de Starlette. /// /// tip | Consejo
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 6.5K bytes - Viewed (0) -
docs/ru/docs/tutorial/testing.md
Это позволяет вам использовать `pytest` без лишних усложнений. /// /// note | Технические детали Также можно написать `from starlette.testclient import TestClient`. **FastAPI** предоставляет тот же самый `starlette.testclient` как `fastapi.testclient`. Это всего лишь небольшое удобство для Вас, как разработчика. Но он берётся напрямую из Starlette. /// /// tip | Подсказка
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 10K bytes - Viewed (0) -
tests/test_security_api_key_cookie.py
from fastapi import Depends, FastAPI, Security from fastapi.security import APIKeyCookie from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() api_key = APIKeyCookie(name="key") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user @app.get("/users/me")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 24 19:03:06 UTC 2025 - 2K bytes - Viewed (0)