Modification of Starlette TestClient to support async calls
Project description
Starlette Async WebSocket Test Client
Description
Modification of Starlette TestClient to support async calls.
Provides async receive*
, send*
for WebSocketTestSession
.
This module is meant to be used with pytest-asyncio
.
Installation
pip install starlette_async_wstc
Usage example
from starlette_async_wstc import TestClient
from somwhere import app # starlette/fastapi app
async def test():
client = TestClient(app)
async with client.websocket_connect('/ws') as wsclient:
await wsclient.send_json({'data': 'test_data'})
resp = await wsclient.receive_json()
assert resp == {}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file starlette_async_wstc-0.1.2.tar.gz
.
File metadata
- Download URL: starlette_async_wstc-0.1.2.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68eb6717b60c381af0ce7aab4995321ae0b78ecef2b85f405f7813ce28405748 |
|
MD5 | 4c619f890d6a1ed9c65cd012b59c736d |
|
BLAKE2b-256 | 0331fb5a1f19df4cdbc27b2c3c01d4fd83350840874a1e078682d423d0814a1f |
File details
Details for the file starlette_async_wstc-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: starlette_async_wstc-0.1.2-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4216e034ebe72d5e7df284cbc003d17461c2edba3c6f19ed1d4c449ee04af52 |
|
MD5 | d0ee1a0e2a7b5e6e83d216fa17429732 |
|
BLAKE2b-256 | 7f949fd5f98c1a80973562f13064410ed762fb2e90ad6bf77cb2a48b476c7640 |