Skip to main content

Standalone stub server for replaying VCR cassettes

Project description

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.

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

vcr-stub-server-0.1.4.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vcr_stub_server-0.1.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file vcr-stub-server-0.1.4.tar.gz.

File metadata

  • Download URL: vcr-stub-server-0.1.4.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.9 Darwin/16.7.0

File hashes

Hashes for vcr-stub-server-0.1.4.tar.gz
Algorithm Hash digest
SHA256 912b4d0ac1cad02515ae539c3536adab5e0544e66c9d24293d9cf5f089db465a
MD5 f3639cca84fb36901f10db992c63229c
BLAKE2b-256 762d02efe054b714042ffbebbb093ebe3d76e4898798e5c2ee238d6c1e44c0c8

See more details on using hashes here.

File details

Details for the file vcr_stub_server-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: vcr_stub_server-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.9 Darwin/16.7.0

File hashes

Hashes for vcr_stub_server-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3b31327bc63fb43be1c70e245d588486f2ec112a247b42df28c71f599b845490
MD5 60eefd539bf15ed225f0d55a42130f9e
BLAKE2b-256 2dd55286969aec1777822c30a9711007833160046fbc77f3a08740b27307e42c

See more details on using hashes here.

Supported by

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