Metadata-Version: 2.1
Name: starlette-async-wstc
Version: 0.1.2
Summary: Modification of Starlette TestClient to support async calls
Home-page: https://github.com/Randomneo/starlette_async_wstc
Author: Rostyslav Misiura
Author-email: rostislav9999@gmail.com
Maintainer: Rostyslav Misiura
Maintainer-email: rostislav9999@gmail.com
License: GNU Affero General Public License, version 3
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.6
Description-Content-Type: text/markdown
License-File: LICENSE.md

[![PyPI version](https://badge.fury.io/py/starlette_async_wstc.svg)](https://badge.fury.io/py/starlette_async_wstc)

# 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 == {}
