Git Product home page Git Product logo

python-contract-test-demo's Introduction

python-contract-test-demo

CI codecov

Creating a virtual env

Development should be done in a virtual environment; a conda environment file conda.yml can be found in the project root and a new environment can be created via

conda env create -f conda.yaml

Contract test

We put all the configuration in api/dredd.yaml which contains information on how we would start the server as well as the location of the api spec and the hooks.

As Dredd is based on Javascript, we have also put in package.json to define the dependencies and how we would run the test. Assuming that you have npm/yarn installed, running the contract test locally is simply

yarn test

Running the test against another environment requires a little bit more effort, and in general it is likely to be easier to use a docker image to run the contract test instead during local development with a development server.

# have a development server running in the background
uvicorn demo.main:app --reload
# then run the contract test
docker run -it -v $(pwd):/mnt apiaryio/dredd:13.1.2 /mnt/api/open-api.yaml localhost:8000 --hooksfile=/mnt/api/hooks.js

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.