- Sort Score
- Result 10 results
- Languages All
Results 51 - 60 of 155 for Reaber (0.13 sec)
-
tests/test_tutorial/test_websockets/test_tutorial002_an_py39.py
data = websocket.receive_text() assert data == f"Message text was: {message}, for item ID: foo" @needs_py39 def test_websocket_with_header(app: FastAPI): client = TestClient(app) with pytest.raises(WebSocketDisconnect): with client.websocket_connect("/items/bar/ws?token=some-token") as websocket: message = "Message one"
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 3.9K bytes - Viewed (0) -
tests/test_starlette_exception.py
@app.get("/items/{item_id}") async def read_item(item_id: str): if item_id not in items: raise HTTPException( status_code=404, detail="Item not found", headers={"X-Error": "Some custom header"}, ) return {"item": items[item_id]} @app.get("/http-no-body-statuscode-exception") async def no_body_status_code_exception(): raise HTTPException(status_code=204)
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jun 30 18:25:16 GMT 2023 - 7.4K bytes - Viewed (0) -
tests/test_ws_router.py
import functools import pytest from fastapi import ( APIRouter, Depends, FastAPI, Header, WebSocket, WebSocketDisconnect, status, ) from fastapi.middleware import Middleware from fastapi.testclient import TestClient router = APIRouter() prefix_router = APIRouter() native_prefix_route = APIRouter(prefix="/native") app = FastAPI() @app.websocket_route("/")
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sun Jun 11 19:08:14 GMT 2023 - 7.5K bytes - Viewed (0) -
tests/test_tutorial/test_path_params/test_tutorial005.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Sep 28 04:14:40 GMT 2023 - 5K bytes - Viewed (0) -
tests/test_security_http_bearer_optional.py
client = TestClient(app) def test_security_http_bearer(): response = client.get("/users/me", headers={"Authorization": "Bearer foobar"}) assert response.status_code == 200, response.text assert response.json() == {"scheme": "Bearer", "credentials": "foobar"} def test_security_http_bearer_no_credentials(): response = client.get("/users/me")
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jun 30 18:25:16 GMT 2023 - 2.1K bytes - Viewed (0) -
tests/test_security_oauth2_password_bearer_optional_description.py
assert response.status_code == 200, response.text assert response.json() == {"msg": "Create an account first"} def test_token(): response = client.get("/items", headers={"Authorization": "Bearer testtoken"}) assert response.status_code == 200, response.text assert response.json() == {"token": "testtoken"} def test_incorrect_token():
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jun 30 18:25:16 GMT 2023 - 2.2K bytes - Viewed (0) -
tests/test_security_oauth2.py
client = TestClient(app) def test_security_oauth2(): response = client.get("/users/me", headers={"Authorization": "Bearer footokenbar"}) assert response.status_code == 200, response.text assert response.json() == {"username": "Bearer footokenbar"} def test_security_oauth2_password_other_header(): response = client.get("/users/me", headers={"Authorization": "Other footokenbar"})
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 10.7K bytes - Viewed (0) -
tests/test_tutorial/test_header_params/test_tutorial002_an_py39.py
@pytest.fixture(name="client") def get_client(): from docs_src.header_params.tutorial002_an_py39 import app client = TestClient(app) return client @needs_py39 @pytest.mark.parametrize( "path,headers,expected_status,expected_response", [ ("/items", None, 200, {"strange_header": None}), ("/items", {"X-Header": "notvalid"}, 200, {"strange_header": None}), ( "/items",
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 4.2K bytes - Viewed (0) -
docs_src/header_params/tutorial002_py310.py
from fastapi import FastAPI, Header app = FastAPI() @app.get("/items/") async def read_items( strange_header: str | None = Header(default=None, convert_underscores=False), ):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Mar 26 16:56:53 GMT 2024 - 228 bytes - Viewed (0) -
docs_src/header_params/tutorial002_an.py
from typing import Union from fastapi import FastAPI, Header from typing_extensions import Annotated app = FastAPI() @app.get("/items/") async def read_items( strange_header: Annotated[ Union[str, None], Header(convert_underscores=False) ] = None, ):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Oct 24 20:26:06 GMT 2023 - 317 bytes - Viewed (0)