Open bethesque opened 2 years ago
It would be good to hook this project up with a python verifier over using the pact-cli
https://github.com/pactflow/example-provider-python
which can be hooked up with this consumer project
https://github.com/pactflow/example-consumer-python
options documented in #346
source code tests here
where the verifier e2e tests live here
examples/message/tests/provider/test_message_provider.py
examples/flask_provider/tests/provider/test_provider.py
examples/fastapi_provider/tests/provider/test_provider.py
We would happily accept contributions to improve the examples, either in this repo, the pactflow examples, or in a pact python workshop (to anyone reading this!)
Main docs https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors
Python Example
verifier = Verifier(
provider="Your provider",
broker_url="...",
consumer_version_selectors=[
{"mainBranch": True}, # (recommended) - Returns the pacts for consumers configured mainBranch property
{"deployedOrReleased": True}, # (recommended) - Returns the pacts for all versions of the consumer that are currently deployed or released and currently supported in any environment.
{"deployed": "test"}, # Normally, this would not be needed, Any versions currently deployed to the specified environment.
{"deployed": "production"}, # Normally, this would not be needed, Any versions currently deployed to the specified environment.
{"environment": "test"}, # Normally, this would not be needed, Any versions currently deployed or released and supported in the specified environment.
{"environment": "production"}, # Normally, this would not be needed, Any versions currently deployed or released and supported in the specified environment.
],
# ...
)
Taken from my WIP code sample updates on the website - which shows snippets in other languages, and other selectors
I'm trying to find an example for someone because I'm not familiar with the python CLI/API and I can't find one anywhere!