Skip to main content

pytest-tiny-api-client

License: GPL  v2

An official companion pytest plugin for the tiny-api-client library.

from my_api import MyClient

def test_my_client(api_call):
    api_call.return_value = {"name": "Peter"}
    user = MyClient().find_user(user_id=...)
    assert user.name == "Peter"

One of the problems with testing functions that have been decorated is that decoration happens at import time, which means the decorators cannot be patched within each test without having to re-import the modules.

This plugin will patch these decorators at import time, and allow you to patch the implementation during testing. To make this easier, this plugin exposes the api_call fixture, which is a unittest.mock.Mock object which can be used to test your endpoint methods with fake data.

For more details on how to use this fixture, check the documentation.

Installation

pip install pytest-tiny-api-client

Documentation

You can find the documentation at https://tiny-api-client.readthedocs.io

License

License: LGPL  v2.1

This software is distributed under the Lesser General Public License v2.1, more information available at the Free Software Foundation.

Release files for pytest-tiny-api-client 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-tiny-api-client 1.0.1
File Size Uploaded
pytest-tiny-api-client-1.0.1.tar.gz 30.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-tiny-api-client 1.0.1
File Interpreter ABI Platform
pytest_tiny_api_client-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 43.3 kB

Release files / pytest-tiny-api-client-1.0.1.tar.gz

Download URL pytest-tiny-api-client-1.0.1.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
103d953a362f1cc83266d3cd27fa8eaa2d9c6fd05cf5cd5ef4947255b19931a6
BLAKE2b-256 checksum
How to use checksums
5fe6b3a696b41771d358445a004f938d01f691f6644c459302f0a4d4d33cf195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release files / pytest_tiny_api_client-1.0.1-py3-none-any.whl

Download URL pytest_tiny_api_client-1.0.1-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7aa6be80ef3e7fec113b9604538aec24276c64cdf4fff11f30315d91fd97a70d
BLAKE2b-256 checksum
How to use checksums
0014083a5bc8d602a9cda19cfa26bfe97116b8f8e6039c9ef1e7bd1f202d4aa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page