- Sort Score
- Result 10 results
- Languages All
Results 131 - 140 of 1,452 for DEF (0.02 sec)
-
tests/test_tutorial/test_request_files/test_tutorial001.py
] } ) def test_post_file(tmp_path): path = tmp_path / "test.txt" path.write_bytes(b"<file content>") client = TestClient(app) with path.open("rb") as file: response = client.post("/files/", files={"file": file}) assert response.status_code == 200, response.text assert response.json() == {"file_size": 14} def test_post_large_file(tmp_path):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 7.7K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial001_an.py
] } ) def test_post_file(tmp_path): path = tmp_path / "test.txt" path.write_bytes(b"<file content>") client = TestClient(app) with path.open("rb") as file: response = client.post("/files/", files={"file": file}) assert response.status_code == 200, response.text assert response.json() == {"file_size": 14} def test_post_large_file(tmp_path):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 7.5K bytes - Viewed (0) -
docs_src/app_testing/app_b_py310/test_main.py
from .main import app client = TestClient(app) def test_read_item(): response = client.get("/items/foo", headers={"X-Token": "coneofsilence"}) assert response.status_code == 200 assert response.json() == { "id": "foo", "title": "Foo", "description": "There goes my hero", } def test_read_item_bad_token():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Mar 13 19:07:10 UTC 2024 - 1.8K bytes - Viewed (0) -
tests/test_response_model_data_filter_no_inheritance.py
name: str owner: UserDB class PetOut(BaseModel): name: str owner: User @app.post("/users/", response_model=User) async def create_user(user: UserCreate): return user @app.get("/pets/{pet_id}", response_model=PetOut) async def read_pet(pet_id: int): user = UserDB( email="******@****.***", hashed_password="secrethashed", )
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 1.7K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial002_py39.py
from fastapi import FastAPI from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="app") def get_app(): from docs_src.request_files.tutorial002_py39 import app return app @pytest.fixture(name="client") def get_client(app: FastAPI): client = TestClient(app) return client file_required = { "detail": [ {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 9K bytes - Viewed (0) -
tests/test_tutorial/test_request_form_models/test_tutorial002_an_py39.py
from fastapi.testclient import TestClient from tests.utils import needs_py39, needs_pydanticv2 @pytest.fixture(name="client") def get_client(): from docs_src.request_form_models.tutorial002_an_py39 import app client = TestClient(app) return client @needs_pydanticv2 @needs_py39 def test_post_body_form(client: TestClient): response = client.post("/login/", data={"username": "Foo", "password": "secret"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Sep 06 17:31:18 UTC 2024 - 6.3K bytes - Viewed (0) -
build-logic/build-update-utils/src/test/groovy/gradlebuild/buildutils/tasks/UpdateKotlinVersionsTest.groovy
Registered: Wed Nov 06 11:36:14 UTC 2024 - Last Modified: Tue Jul 23 22:23:07 UTC 2024 - 2.7K bytes - Viewed (0) -
tests/test_http_connection_injection.py
from starlette.websockets import WebSocket app = FastAPI() app.state.value = 42 async def extract_value_from_http_connection(conn: HTTPConnection): return conn.app.state.value @app.get("/http") async def get_value_by_http(value: int = Depends(extract_value_from_http_connection)): return value @app.websocket("/ws") async def get_value_by_ws( websocket: WebSocket, value: int = Depends(extract_value_from_http_connection)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Aug 09 13:56:41 UTC 2020 - 972 bytes - Viewed (0) -
tests/test_router_redirect_slashes.py
from fastapi import APIRouter, FastAPI from fastapi.testclient import TestClient def test_redirect_slashes_enabled(): app = FastAPI() router = APIRouter() @router.get("/hello/") def hello_page() -> str: return "Hello, World!" app.include_router(router) client = TestClient(app) response = client.get("/hello/", follow_redirects=False) assert response.status_code == 200
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jun 22 10:37:50 UTC 2023 - 974 bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial001_an_py39.py
from dirty_equals import IsDict from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="client") def get_client(): from docs_src.request_files.tutorial001_an_py39 import app client = TestClient(app) return client @needs_py39 def test_post_form_no_body(client: TestClient): response = client.post("/files/") assert response.status_code == 422, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 7.7K bytes - Viewed (0)