Skip to content

edwintye/python-contract-test-demo

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors