Skip to main content

vcr-stub-server

PyPI version

This is a small tool for setting up a lightweight stub server that replays previously recorded VCR cassettes.

Usually VCR is used internally while running the test suite. In that case, the library is responsible for intercepting HTTP requests.

But in some cases, it can be useful to be able to spin up a live HTTP server which given a preexisting VCR cassette, would respond to each request with its matching recorded response.

One such case might come when implementing usage of Pact, where vcr-stub-server can be used to prevent the provider service from making requests to external services during pact verification. This project was inspired by Pact's own Stub Service.

Caveats

  • Unfortunately, there is no one standard for cassette YAML files, each VCR implementation is different. For example, cassette YAML files created by VCR.py won't be compatible with YAML files created by the Ruby implementation of VCR, etc.

    Therfore this tool currently only supports VCR.py, using the library's own implementation of parsing the YAML files.

  • The recorded requests in your YAML cassette file must all be made to the same host.

Installation

$ pip install vcr-stub-server

Usage

Once the package is installed, use the vcr-stub-server command to spin up your stub server.

$ vcr-stub-server path/to/vcr_cassette.yml

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/thatguysimon/vcr-stub-server. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Metadata

Release files for vcr-stub-server 0.1.4

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

Source distribution (sdist)

Source distribution for vcr-stub-server 0.1.4
File Size Uploaded
vcr-stub-server-0.1.4.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vcr-stub-server 0.1.4
File Interpreter ABI Platform
vcr_stub_server-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / vcr-stub-server-0.1.4.tar.gz

Download URL vcr-stub-server-0.1.4.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
912b4d0ac1cad02515ae539c3536adab5e0544e66c9d24293d9cf5f089db465a
BLAKE2b-256 checksum
How to use checksums
762d02efe054b714042ffbebbb093ebe3d76e4898798e5c2ee238d6c1e44c0c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.6.9 Darwin/16.7.0

Release files / vcr_stub_server-0.1.4-py3-none-any.whl

Download URL vcr_stub_server-0.1.4-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b31327bc63fb43be1c70e245d588486f2ec112a247b42df28c71f599b845490
BLAKE2b-256 checksum
How to use checksums
2dd55286969aec1777822c30a9711007833160046fbc77f3a08740b27307e42c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.6.9 Darwin/16.7.0

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.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