Modification of Starlette TestClient to support async calls
Project description
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
starlette_async_wstc-0.1.1.tar.gz
(17.0 kB
view hashes)
Built Distribution
Close
Hashes for starlette_async_wstc-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0544d821ed5f2223a81bc3b326ff41970d7ce9f2e8378bcc1532006974ef0331 |
|
MD5 | 58051627e6c62ee295dd7a5f60733f57 |
|
BLAKE2b-256 | 6c0e6876892b234c87be66c44b89c12c4d451ce1c87842bab9cbb3d2d3deefe8 |
Close
Hashes for starlette_async_wstc-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e65be972c58ffe9b535a393d655f0a54e5a72c64376647e35eaff77c7ec688ae |
|
MD5 | 16af85a4aa7dfbe08e19942ac9691865 |
|
BLAKE2b-256 | 17302172c2d888f9d0c73e4f7e0a780b6ecf9a9e3005a30d04202c9b61aecd23 |