test_websocket_with_header() — fastapi Function Reference
Architecture documentation for the test_websocket_with_header() function in test_tutorial002.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD e8765ed0_bcb2_c788_fd03_cfa5b55ae84e["test_websocket_with_header()"] 45a8bc94_3841_f038_9f98_489f355c96bd["test_tutorial002.py"] e8765ed0_bcb2_c788_fd03_cfa5b55ae84e -->|defined in| 45a8bc94_3841_f038_9f98_489f355c96bd style e8765ed0_bcb2_c788_fd03_cfa5b55ae84e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_tutorial/test_websockets/test_tutorial002.py lines 51–66
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"
websocket.send_text(message)
data = websocket.receive_text()
assert data == "Session cookie or query token value is: some-token"
data = websocket.receive_text()
assert data == f"Message text was: {message}, for item ID: bar"
message = "Message two"
websocket.send_text(message)
data = websocket.receive_text()
assert data == "Session cookie or query token value is: some-token"
data = websocket.receive_text()
assert data == f"Message text was: {message}, for item ID: bar"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_websocket_with_header() do?
test_websocket_with_header() is a function in the fastapi codebase, defined in tests/test_tutorial/test_websockets/test_tutorial002.py.
Where is test_websocket_with_header() defined?
test_websocket_with_header() is defined in tests/test_tutorial/test_websockets/test_tutorial002.py at line 51.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free