- Sort Score
- Result 10 results
- Languages All
Results 321 - 330 of 1,379 for def2 (0.02 sec)
-
tests/test_tutorial/test_websockets/test_tutorial002_an.py
from fastapi.websockets import WebSocketDisconnect from docs_src.websockets.tutorial002_an import app def test_main(): client = TestClient(app) response = client.get("/") assert response.status_code == 200, response.text assert b"<!DOCTYPE html>" in response.content def test_websocket_with_cookie(): client = TestClient(app, cookies={"session": "fakesession"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 3.6K bytes - Viewed (0) -
docs_src/custom_docs_ui/tutorial001.py
) @app.get(app.swagger_ui_oauth2_redirect_url, include_in_schema=False) async def swagger_ui_redirect(): return get_swagger_ui_oauth2_redirect_html() @app.get("/redoc", include_in_schema=False) async def redoc_html(): return get_redoc_html( openapi_url=app.openapi_url, title=app.title + " - ReDoc",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu May 23 22:59:02 UTC 2024 - 1.1K bytes - Viewed (0) -
tests/test_tutorial/test_schema_extra_example/test_tutorial004_an_py39.py
from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="client") def get_client(): from docs_src.schema_extra_example.tutorial004_an_py39 import app client = TestClient(app) return client # Test required and embedded body parameters with no bodies sent @needs_py39 def test_post_body_example(client: TestClient): response = client.put( "/items/5", json={
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 7.1K bytes - Viewed (0) -
tests/test_tutorial/test_schema_extra_example/test_tutorial004_py310.py
from fastapi.testclient import TestClient from ...utils import needs_py310 @pytest.fixture(name="client") def get_client(): from docs_src.schema_extra_example.tutorial004_py310 import app client = TestClient(app) return client # Test required and embedded body parameters with no bodies sent @needs_py310 def test_post_body_example(client: TestClient): response = client.put( "/items/5", json={
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 7.1K bytes - Viewed (0) -
docs_src/settings/app03_an_py39/main.py
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): return { "app_name": settings.app_name, "admin_email": settings.admin_email,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 462 bytes - Viewed (0) -
docs_src/settings/app02_an/test_main.py
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="******@****.***") app.dependency_overrides[get_settings] = get_settings_override def test_app(): response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 515 bytes - Viewed (0) -
docs_src/settings/app02_an_py39/test_main.py
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="******@****.***") app.dependency_overrides[get_settings] = get_settings_override def test_app(): response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 515 bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial003_an.py
assert response.status_code == 200, response.text assert response.json() == {"filenames": ["test.txt", "test2.txt"]} def test_get_root(): client = TestClient(app) response = client.get("/") assert response.status_code == 200, response.text assert b"<form" in response.content def test_openapi_schema(): response = client.get("/openapi.json") assert response.status_code == 200, response.text
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_invalid_path_param.py
app = FastAPI() @app.get("/items/{id}") def read_items(id: list): pass # pragma: no cover def test_invalid_simple_tuple(): with pytest.raises(AssertionError): app = FastAPI() @app.get("/items/{id}") def read_items(id: tuple): pass # pragma: no cover def test_invalid_simple_set(): with pytest.raises(AssertionError):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon Jun 03 17:59:40 UTC 2019 - 1.7K bytes - Viewed (0) -
tests/test_get_request_body.py
price: float @app.get("/product") async def create_item(product: Product): return product client = TestClient(app) def test_get_with_body(): body = {"name": "Foo", "description": "Some description", "price": 5.5} response = client.request("GET", "/product", json=body) assert response.json() == body def test_openapi_schema(): response = client.get("/openapi.json")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.7K bytes - Viewed (0)