Skip to main content

recorder-mock allows to record interactions on patched Python objects and repeat the interactions when the patched object is no longer available.

Project description

recorder-mock allows to record interactions on patched Python objects and repeat the interactions when the patched object is no longer available.

Installation

pip install recorder-mock

Usage

from recorder_mock import recorder_patch

@recorder_patch("httpx")
class ExampleTestCase(unittest.TestCase):
    def test_get_example_com_content():
        client = httpx.client()
        resp = client.get("example.com")
        return resp.content

First execution of the tests will hit the Internet and record the interactions. Second test run won't hit the internet, recorded interactions will be repeated instead.

Related projects

This tool was inspired by:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

recorder_mock-0.0.1.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

recorder_mock-0.0.1-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page