-
-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add tests for custom request and websocket classes examples in …
…docs
- Loading branch information
kedod
committed
Mar 9, 2024
1 parent
84af179
commit 87f559f
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from docs.examples.websockets.custom_websocket import app as custom_websocket_class_app | ||
|
||
from litestar.testing.client.sync_client import TestClient | ||
|
||
|
||
def test_custom_websocket_class(): | ||
client = TestClient(app=custom_websocket_class_app) | ||
|
||
with client.websocket_connect("/") as ws: | ||
ws.send({"data": "I should not be in response"}) | ||
data = ws.receive() | ||
assert data["text"] == "Fixed response" |