An API client for simplifying API testing with Python + PyTest
Project description
🔥 berAPI 🔥
An API client for simplifying API testing with Python + PyTest
Features
- Builtin curl API in the
pytest-htmlreport - Easy to import the API logs into Postman/curl
- Multiple common assertions to a single request
Installation
pip3 install berapi
How to use
Create an instance of berAPI class, and you can build API test request and assertion chain of the response
from berapi.apy import berAPI
def test_simple():
url = 'https://swapi.dev/api/people/1'
api = berAPI()
response = api.get(url).assert_2xx().parse_json()
assert response['name'] == 'Luke Skywalker'
def test_chaining():
(berAPI()
.get('https://swapi.dev/api/people/1')
.assert_2xx()
.assert_value('name', 'Luke Skywalker')
.assert_response_time_less_than(seconds=1)
)
To have robust response log make sure you enable settings in pytest.ini
[pytest]
log_cli_level = INFO
Install Development
pip install poetry
poetry install --with test
Run Test
poetry run pytest tests
Building Lib
poetry build
poetry publish
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file berapi-0.1.3.tar.gz.
File metadata
- Download URL: berapi-0.1.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.1 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
129b6113d8c01fa545f46c15c29e5cfbbf335316084cbede5751f6b08ca1abed
|
|
| MD5 |
2d7592be10fca52971a5d601d7f1832d
|
|
| BLAKE2b-256 |
ecc32926a8ee6abbde09d19706fa8b11e0aeff1809471509a67f043d00a951b3
|
File details
Details for the file berapi-0.1.3-py3-none-any.whl.
File metadata
- Download URL: berapi-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.1 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ba3fcb5dd91f8359019aecb82160eba7cf93cc55b1abd628a0ca67e6236bb3e
|
|
| MD5 |
c21cd90a558af9875aa1ede8f6f3e515
|
|
| BLAKE2b-256 |
a8d1c8f46938f3c85dfd06ce0c8cf01e04fec0cf86e05deb6c70c47c06837714
|