Giter VIP home page Giter VIP logo

consumer-pact-example's Introduction

Consumer API Example

Test Code Coverage Status

This is a Python application for explanation of Contract Testing based on Pact.

Here you can find out how to use Pact using the Python language. You can find more of an overview on Pact in the Pact Introduction.

This project uses:

  • Pact, a code-first tool for testing HTTP and message integrations using contract tests
  • pact-python, to create and verify consumer driven contracts

Interaction diagram

Consumer (this project)

Consumer API Example is a simple HTTP client that makes requests to Provider, gets response from API server and creates data model using the data from responses. For demonstration purposes, the project has simplified logic and should not be considered as a full-fledged Production-ready solution.

Provider

For the purity of the experiment, the provider is implemented as a separate project and can be found at the following repo.

Pact

Sample contracts (pacts) are located in tests/pacts.

Getting Started

Prerequisites

What kind of things you need to install on your workstation to start:

  • Python >= 3.11
  • Docker / Rancher
  • Docker Compose / Rancher Compose

Installing

First, install Python dependencies for consumer:

$ make init
$ make install

Run tests

To run unit tests use the command as follows:

$ make test

Run the dockerized broker using the docker-compose.yml file in the root of the project:

$ docker compose -d

To publish contracts (pacts) to the broker use the following command:

$ ./publish-contracts.sh

Run lint check

To run code style checking use the command as follows:

$ make lint

Project Information

Consumer API Example is released under the MIT License, and its code lives at GitHub. It’s rigorously tested on Python 3.11+.

If you'd like to contribute to Consumer API Example you're most welcome!

Support

Should you have any question, any remark, or if you find a bug, or if there is something you can't do with the Consumer API Example, please open an issue.

consumer-pact-example's People

Contributors

dependabot[bot] avatar sergeyklay avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

you54f

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.