- Sort Score
- Result 10 results
- Languages All
Results 391 - 400 of 511 for testClient2 (0.07 sec)
-
tests/test_tutorial/test_response_headers/test_tutorial001.py
from fastapi.testclient import TestClient from docs_src.response_headers.tutorial001 import app client = TestClient(app) def test_path_operation(): response = client.get("/headers/") assert response.status_code == 200, response.text assert response.json() == {"message": "Hello World"} assert response.headers["X-Cat-Dog"] == "alone in the world"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 09 18:06:12 UTC 2020 - 426 bytes - Viewed (0) -
docs/tr/docs/advanced/testing-websockets.md
# WebSockets'i Test Etmek WebSockets testi yapmak için `TestClient`'ı kullanabilirsiniz. Bu işlem için, `TestClient`'ı bir `with` ifadesinde kullanarak WebSocket'e bağlanabilirsiniz: ```Python hl_lines="27-31" {!../../docs_src/app_testing/tutorial002.py!} ``` /// note | "Not"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 472 bytes - Viewed (0) -
tests/test_custom_route_class.py
import pytest from fastapi import APIRouter, FastAPI from fastapi.routing import APIRoute from fastapi.testclient import TestClient from starlette.routing import Route app = FastAPI() class APIRouteA(APIRoute): x_type = "A" class APIRouteB(APIRoute): x_type = "B" class APIRouteC(APIRoute): x_type = "C" router_a = APIRouter(route_class=APIRouteA) router_b = APIRouter(route_class=APIRouteB)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.1K bytes - Viewed (0) -
tests/test_tutorial/test_response_model/test_tutorial004.py
import pytest from dirty_equals import IsDict, IsOneOf from fastapi.testclient import TestClient from docs_src.response_model.tutorial004 import app client = TestClient(app) @pytest.mark.parametrize( "url,data", [ ("/items/foo", {"name": "Foo", "price": 50.2}), ( "/items/bar", {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2}, ), (
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 04 20:47:07 UTC 2023 - 5K bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial009.py
from pathlib import Path from fastapi.testclient import TestClient from docs_src.custom_response import tutorial009 from docs_src.custom_response.tutorial009 import app client = TestClient(app) def test_get(tmp_path: Path): file_path: Path = tmp_path / "large-video-file.mp4" tutorial009.some_file_path = str(file_path) test_content = b"Fake video bytes" file_path.write_bytes(test_content) response = client.get("/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Jul 03 19:51:28 UTC 2021 - 487 bytes - Viewed (0) -
tests/test_callable_endpoint.py
from functools import partial from typing import Optional from fastapi import FastAPI from fastapi.testclient import TestClient def main(some_arg, q: Optional[str] = None): return {"some_arg": some_arg, "q": q} endpoint = partial(main, "foo") app = FastAPI() app.get("/")(endpoint) client = TestClient(app) def test_partial(): response = client.get("/?q=bar") data = response.json()
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Jun 28 18:13:30 UTC 2020 - 457 bytes - Viewed (0) -
tests/test_tutorial/test_cookie_params/test_tutorial001_an.py
import pytest from dirty_equals import IsDict from fastapi.testclient import TestClient from docs_src.cookie_params.tutorial001_an import app @pytest.mark.parametrize( "path,cookies,expected_status,expected_response", [ ("/items", None, 200, {"ads_id": None}), ("/items", {"ads_id": "ads_track"}, 200, {"ads_id": "ads_track"}), ( "/items",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 3.9K bytes - Viewed (0) -
tests/test_tutorial/test_generate_clients/test_tutorial003.py
from fastapi.testclient import TestClient from docs_src.generate_clients.tutorial003 import app client = TestClient(app) def test_post_items(): response = client.post("/items/", json={"name": "Foo", "price": 5}) assert response.status_code == 200, response.text assert response.json() == {"message": "Item received"} def test_post_users(): response = client.post(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 7.1K bytes - Viewed (0) -
tests/test_dependency_class.py
from typing import AsyncGenerator, Generator import pytest from fastapi import Depends, FastAPI from fastapi.testclient import TestClient app = FastAPI() class CallableDependency: def __call__(self, value: str) -> str: return value class CallableGenDependency: def __call__(self, value: str) -> Generator[str, None, None]: yield value class AsyncCallableDependency:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Aug 09 10:54:05 UTC 2020 - 3.3K bytes - Viewed (0) -
tests/test_tutorial/test_additional_status_codes/test_tutorial001.py
from fastapi.testclient import TestClient from docs_src.additional_status_codes.tutorial001 import app client = TestClient(app) def test_update(): response = client.put("/items/foo", json={"name": "Wrestlers"}) assert response.status_code == 200, response.text assert response.json() == {"name": "Wrestlers", "size": None} def test_create(): response = client.put("/items/red", json={"name": "Chillies"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 09 18:06:12 UTC 2020 - 546 bytes - Viewed (0)