webtest-aiohttp provides integration of WebTest with aiohttp.web applications.
Supports aiohttp>=2.3.8.
from aiohttp import web
from webtest_aiohttp import TestApp
app = web.Application()
async def hello(request):
return web.json_response({'message': 'Hello world'})
app.router.add_route('GET', '/', handler)
def test_hello(loop):
client = TestApp(app, loop=loop)
res = client.get('/')
assert res.status_code == 200
assert res.json == {'message': 'Hello world'}
Installation
pip install webtest-aiohttp
Note: If you are using aiohttp<2.0.0, you will need to install webtest-aiohttp 1.x.
pip install 'webtest-aiohttp<2.0.0'
Usage with pytest
If you are using pytest and pytest-aiohttp, you can make your tests more concise with a fixture.
from aiohttp import web
from webtest_aiohttp import TestApp as WebTestApp
app = web.Application()
async def hello(request):
return web.json_response({'message': 'Hello world'})
app.router.add_route('GET', '/', handler)
@pytest.fixture()
def testapp(loop):
return WebTestApp(app, loop=loop)
def test_get(testapp):
assert testapp.get('/').json == {'message': 'Hello world'}
Project Links
License
MIT licensed. See the bundled LICENSE file for more details.
Metadata
Release files for webtest-aiohttp 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| webtest-aiohttp-2.0.0.tar.gz | 8.4 kB | Without provenance | Details for webtest-aiohttp-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| webtest_aiohttp-2.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for webtest_aiohttp-2.0.0-py2.py3-none-any.whl |
Total release size: 13.1 kB
Release files / webtest-aiohttp-2.0.0.tar.gz
| Download URL | webtest-aiohttp-2.0.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58e2a2f13078c3f1f23ccebef03de4d6d118d096cd6e9d0d190e359d9ffb11f8
|
|
BLAKE2b-256 checksum How to use checksums |
1f469c3f326522b83253b7156007c96977d6bb5fcf78b1dcb1da1b928ab876b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / webtest_aiohttp-2.0.0-py2.py3-none-any.whl
| Download URL | webtest_aiohttp-2.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a8fc39fd73f30bb56c8b990e6a70ca477522f5b1a91b3b6c91401ecbca750847
|
|
BLAKE2b-256 checksum How to use checksums |
f4646ac160e44859602962495e0d52ef8bac1e244c48365b38d7424d2dc70222
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for webtest-aiohttp 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.