test_websocket_with_header_and_query() — fastapi Function Reference
Architecture documentation for the test_websocket_with_header_and_query() function in test_tutorial002.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD d053f3bd_ed45_8dbf_b7ec_8ff8f87785df["test_websocket_with_header_and_query()"] 45a8bc94_3841_f038_9f98_489f355c96bd["test_tutorial002.py"] d053f3bd_ed45_8dbf_b7ec_8ff8f87785df -->|defined in| 45a8bc94_3841_f038_9f98_489f355c96bd style d053f3bd_ed45_8dbf_b7ec_8ff8f87785df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_tutorial/test_websockets/test_tutorial002.py lines 69–88
def test_websocket_with_header_and_query(app: FastAPI):
client = TestClient(app)
with pytest.raises(WebSocketDisconnect):
with client.websocket_connect("/items/2/ws?q=3&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 == "Query parameter q is: 3"
data = websocket.receive_text()
assert data == f"Message text was: {message}, for item ID: 2"
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 == "Query parameter q is: 3"
data = websocket.receive_text()
assert data == f"Message text was: {message}, for item ID: 2"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_websocket_with_header_and_query() do?
test_websocket_with_header_and_query() is a function in the fastapi codebase, defined in tests/test_tutorial/test_websockets/test_tutorial002.py.
Where is test_websocket_with_header_and_query() defined?
test_websocket_with_header_and_query() is defined in tests/test_tutorial/test_websockets/test_tutorial002.py at line 69.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free