Code Monkey home page Code Monkey logo

vcr-stub-server's Introduction

vcr-stub-server

pypi-version python-version Code style: black

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 isn't one standard for cassette YAML files, each VCR implementation does it differently. 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.

vcr-stub-server's People

Contributors

thatguysimon avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

justinc1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.