https://github.com/sloria/webtest-asgi
Integration of WebTest with ASGI applications.
https://github.com/sloria/webtest-asgi
asgi starlette testing webtest
Last synced: 7 months ago
JSON representation
Integration of WebTest with ASGI applications.
- Host: GitHub
- URL: https://github.com/sloria/webtest-asgi
- Owner: sloria
- License: mit
- Created: 2019-01-02T23:27:59.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2025-08-04T20:36:25.000Z (7 months ago)
- Last Synced: 2025-08-04T23:02:03.092Z (7 months ago)
- Topics: asgi, starlette, testing, webtest
- Language: Python
- Homepage:
- Size: 61.5 KB
- Stars: 7
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
************
webtest-asgi
************
.. image:: https://badgen.net/pypi/v/webtest-asgi
:alt: Latest version
:target: https://pypi.org/project/webtest-asgi/
.. image:: https://github.com/sloria/webtest-asgi/actions/workflows/build-release.yml/badge.svg
:alt: Build status
:target: https://github.com/sloria/webtest-asgi/actions/workflows/build-release.yml
webtest-asgi provides integration of `WebTest `_ with `ASGI `_ applications.
Disclaimer
==========
You should probably use Starlette's `TestClient `_
instead of this package for testing ASGI applications.
This package was created to test `webargs-starlette `_ using
webargs' ``CommonTestCase``, which uses WebTest to test common
functionality across multiple web frameworks.
Installation
============
::
pip install webtest-asgi
Usage
=====
You can use webtest-asgi with any ASGI application. Here is example usage with `Starlette `_.
.. code-block:: python
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from webtest_asgi import TestApp as WebTestApp
app = Starlette()
@app.route("/")
async def homepage(request):
return JSONResponse({"hello": "world"})
@pytest.fixture()
def testapp():
return WebTestApp(app)
def test_get_homepage(testapp):
assert testapp.get("/").json == {"hello": "world"}
Project Links
=============
- PyPI: https://pypi.python.org/pypi/webtest-asgi
- Issues: https://github.com/sloria/webtest-asgi/issues
License
=======
MIT licensed. See the bundled `LICENSE `_ file for more details.