Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project. Currently supports version 2 of the Pact specification.
Questions tagged [pact-python]
14 questions
3
votes
2 answers
Pact: how to set up provider states
I'm looking at the Python implementation of Pact and trying to set up provider states. It seems to say that the way to do it is for the provider to have an endpoint built into the service that is called to put the provider in the correct state. …

ewok
- 20,148
- 51
- 149
- 254
1
vote
1 answer
How to mock a https server by pact-python, could you give me a example
I can't mock a https serve according to API,please give me some advice
python version: 3.6.5
pact-python: 1.0
pytest:5.3.5
platform:windows
Error message:
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=1234): Max…

Nick_wang
- 13
- 2
1
vote
1 answer
pact: validate that an array contains a matching hash
I have a service that returns an array of hashes, the order of which is non-deterministic. I need to validate that there exists one hash that has a certain key/value, and that hash is populated with data, but the rest of the hashes I don't care…

ewok
- 20,148
- 51
- 149
- 254
0
votes
1 answer
How to Pact test a dictionary object
The below test will pass correctly, but if I post a body of {"a different key" : 4.56} it will fail as "key" is expected. In other words, the dictionary key is not flexible, only the float value.
How can I define a pact where only the dictionary…

Conor
- 535
- 2
- 8
- 16
0
votes
2 answers
Pact testing nullable values
I want to test a nullable field with pact, so I have one test where
def test_post_1(pact, client):
(
pact.given("object doesnt exist")
.upon_receiving("a new post request with data")
.with_request(
"post",…

Conor
- 535
- 2
- 8
- 16
0
votes
1 answer
How to solve SSL - certificate verify failed exception while pact verification, service provider against broker (https broker) using pact-python lib
Facing below error while communicating with https pact broker url, using pact-python lib for contract verification test against broker.
Conn close because of connect error SSL_connect returned=1 errno=0 state=error: certificate verify failed.
I have…

Anant Bhatnagar
- 99
- 2
- 9
0
votes
1 answer
How to pass arguments from in pact state
We are using pact to create some contract tests. We are quite new to this so we do not really know how state works. Right now we only know that the phare we use in the given comes in the state property of the state setup body call.
Given this…

Antonio Gamiz Delgado
- 1,871
- 1
- 12
- 33
0
votes
1 answer
Pact-python : Consumer pacts for POST calls are failing
I am trying to create consumer side pacts for a POST end point using the pact-python library. But it's failing with the error saying "Missing requests".
Here't the client code which makes the POST API call
def create_user(request):
return…

Sree
- 11
- 1
0
votes
1 answer
WARN: Ignoring unsupported matching rules while verifying pact using pact-python
I'm new to Pact and I am trying to verify a pact on provider side using pact-python but some matching rules are getting ignored.
WARN: Ignoring unsupported matching rules {"$.num_issues"=>{"matchers"=>[{"match"=>"integer"}], "combine"=>"AND"},…

Sarthak
- 5
- 1
0
votes
1 answer
Consumer Driven Contract testing (using Pact)- Best Practise
I'm doing a POC for CDC testing using Pactman and pact-python . I'm able to generate pact files and to verify the pacts with provider Base url without registering to pact broker, i'm using following approach.It will check for any failures, will it…

Jagan Reddy
- 39
- 1
- 6
0
votes
3 answers
Actual interactions do not match expected interactions for mock MockService
I'm new to both python and contract testing. I'm trying to test my consumer application using pact-python.
This is the test file test_posts_controller.py
import unittest
import atexit
from pact import Consumer, Provider, Term
import requests
pact =…

Manoj Kumar S
- 634
- 8
- 16
0
votes
1 answer
call real web service code in order to create pact files
can you please help me on below scenario?
i am doing poc on pact and need help on understanding the concept .
do we need to call real web service call code in order to create pact files? if yes, how to create pact files for existing API code
def…

beginner
- 39
- 7
0
votes
1 answer
pact verifier is failing with Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8
i am able to mock using mock service as below but when i try to verify the mock against the provider, it is throwing error. i am suspecting because of date values.can you please help me what might be the issue
Mock Jason file :
@Mattthew - Thank…

beginner
- 39
- 7
0
votes
1 answer
pact -python for QA Team
i am trying to setup pact python project locally and facing issues. it would be great if you help me on these issues
It seems we have to use localhost:1234 from consumer side ? . Can we use real service in place of mocking service ? If I use …

beginner
- 39
- 7