pytest-aiohttp-client
Awesome pytest fixture for awesome aiohttp!
Installation
Install it via pip tool:
pip install pytest-aiohttp-client
or Poetry:
poetry add yandex-geocoder
Usage example
Plugin provides api fixture, but you should define aiohttp_app fixture first:
import pytest
from my_awesome_app import make_app
@pytest.fixture
def aiohttp_app() -> Application:
return make_app()
Default decoding
Fixture will decode and return payload by default as json or bytes (depends on Content-Type header):
async def test_returns_json(api):
got = await api.get("/json-url/")
assert got == {"key": "value"}
async def test_returns_bytes(api):
got = await api.get("/url/")
assert got == b"Some text"
Status code assertions
You can assert on status code:
async def test_returns_ok(api):
await api.get("/url/", expected_status=200)
Response result
Type as_response=True if you need ClientResponse object:
from aiohttp.client import ClientResponse
async def test_returns_response(api):
got = await api.get("/url/", as_response=True)
assert isinstance(got, ClientResponse)
Development and contribution
First of all you should install Poetry.
- install project dependencies
make install
- run linters
make lint
- run tests
make test
- feel free to contribute!
Metadata
Release files for pytest-aiohttp-client 0.1.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 | |
|---|---|---|---|---|
| pytest_aiohttp_client-0.1.0.tar.gz | 3.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_aiohttp_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / pytest_aiohttp_client-0.1.0.tar.gz
| Download URL | pytest_aiohttp_client-0.1.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae2dad8e3db052b3fd0296ce8d542d7f04a911f23f2d82f2777021815e88a708
|
|
BLAKE2b-256 checksum How to use checksums |
16b72fd2ac57a0ceb1ea6d75cd5f82122469225f81e33d57745c039a3389ce4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1024-azure
|
Release files / pytest_aiohttp_client-0.1.0-py3-none-any.whl
| Download URL | pytest_aiohttp_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b20ed9234d3d19493c5a02ff9ccb97a30766f01c11ddd3502b73b665334844f1
|
|
BLAKE2b-256 checksum How to use checksums |
54ea8b8bd7383a0a4f11b6356e6a0b49f230e901805f5bf44747d32ce7f4fc2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1024-azure
|
Security for pytest-aiohttp-client 0.1.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.