webtest-asgi provides integration of WebTest with ASGI applications
Project description
webtest-asgi provides integration of WebTest with ASGI applications.
Installation
pip install webtest-asgi
Usage
You can use webtest-asgi with any ASGI application. Here is example usage with Starlette.
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
License
MIT licensed. See the bundled LICENSE file for more details.
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
webtest-asgi-1.0.1.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for webtest_asgi-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36c638a5e0565fac39a6536d6930081925b5f0d69d3aa7d15acd704208f6bd68 |
|
MD5 | a37e52647b0a86d045d7de3364d68f60 |
|
BLAKE2b-256 | f4a1fb888e151ebb11e2d7d084386a228cac993f4fefe629ce605dfef833a8ad |