Aaron Swerlein
01/09/2023, 2:44 PMpact-verifier
command, it says connection refused on the portGitHub
01/17/2023, 11:51 PM<https://github.com/pact-foundation/pact-python/tree/master|master>
by bethesque
<https://github.com/pact-foundation/pact-python/commit/53ca129dbee544c6e43ce4c01d8a238e9c0c1ac6|53ca129d>
- chore: add workflow to create a jira issue for pactflow team when smartbear-supported label added to github issue
pact-foundation/pact-pythonBram Hautekiet
01/22/2023, 11:00 PMresponse = test_client.get()
, response = <http://test_client.post|test_client.post>()
, ...
Using this test client has some advantages compared to running a local server: it's faster, it makes it easier to mock dependent services (like databases), it makes it very easy to deal with authentication etc...
But as far as I can see the only way of verifying a provider contract is with the standalone pact-verifier tool (or a wrapper around the tool), where you need to pass a provider-base-url which points to a live server?GitHub
01/24/2023, 5:04 PM<https://github.com/pact-foundation/pact-python/tree/master|master>
by elliottmurray
<https://github.com/pact-foundation/pact-python/commit/1bbdd37aeb16993af124e386c3d1d8b96b656f81|1bbdd37a>
- feat: Enhance provider states for pact-message (#322)
pact-foundation/pact-pythonGitHub
01/24/2023, 5:04 PMPetr Šebek
01/25/2023, 2:36 PMclass TestEnumV1(str, Enum):
OPTION_1 = "option_1"
OPTION_2 = "option_2"
OPTION_3 = "option_3"
class TestEnumV2(str, Enum):
OPTION_1 = "option_1"
OPTION_2 = "option_2"
OPTION_3 = "option_3"
OPTION_4 = "option_4"
Note that TestEnumV2
has extra OPTION_4
. I'm sending these messages as JSONs so it will be serialized as "option_4" string. Now TestEnumV1
and TestEnumV2
are not compatible because if publisher sends "option_4"
to a subscriber understanding only TestEnumV1
it will fail because subscriber will not know that value in TestEnumV1
.
However, if I write consumer matcher as pact.Like(TestEnumV1.OPTION_1)
it will happily accept any string.
I can write a regex for it pact.Term(r"^option_1|option_2|option_3$", "option_1")
which would resolve it on consumer side.
But what should I do on provider side? Should I generate and test message with every enum value possible?
Is this (consumer and provider parts) how it should be done?Jayesh Guru
01/25/2023, 3:15 PMself = <pact.pact.Pact object at 0x7f5a847b4a90>
def verify(self):
"""
Have the mock service verify all interactions occurred.
Calls the mock service to verify that all interactions occurred as
expected, and has it write out the contracts to disk.
:raises AssertionError: When not all interactions are found.
"""
self._interactions = []
resp = requests.get(
self.uri + "/interactions/verification", headers=self.HEADERS, verify=False
)
assert resp.status_code == 200, resp.text
resp = <http://requests.post|requests.post>(self.uri + "/pact", headers=self.HEADERS, verify=False)
> assert resp.status_code == 200, resp.text
E AssertionError: {"message":"Error ocurred in mock service: Filelock::ExecTimeout - Didn't finish executing Filelock block within the timeout specified.","backtrace":["/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/reification.rb:31:in `from_term'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/array_like.rb:44:in `block in generate'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/array_like.rb:44:in `times'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/array_like.rb:44:in `each'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/array_like.rb:44:in `collect'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-
Truncated
/pyenv/versions/cmedia-adf-management-api/lib/python3.8/site-packages/pact/pact.py:281: AssertionError
GitHub
01/26/2023, 4:12 PMGitHub
01/27/2023, 12:30 PM<https://github.com/pact-foundation/pact-python/tree/master|master>
by YOU54F
<https://github.com/pact-foundation/pact-python/commit/44cda33f6836bb9e9af1984e5a03f06b5f969904|44cda33f>
- chore: /s/Pactflow/PactFlow
<https://github.com/pact-foundation/pact-python/commit/9c1132ef8ada47aa2d0dd94eb5795d9309e14f03|9c1132ef>
- Merge pull request #325 from pact-foundation/pactflow_camelcase
pact-foundation/pact-pythonIvan Mikhalka
02/06/2023, 8:44 AMpact-python
?GitHub
02/07/2023, 11:00 AMSathish Sundararajan
02/13/2023, 9:21 PMNuno Frias
02/15/2023, 1:21 PMElliott Murray
02/15/2023, 2:34 PMGitHub
02/19/2023, 11:28 AM<https://github.com/pact-foundation/pact-python/tree/master|master>
by elliottmurray
<https://github.com/pact-foundation/pact-python/commit/48b7f3705d927b558e5aa4a95f1a1f6aac332309|48b7f370>
- chore: Releasing version 1.7.0
pact-foundation/pact-pythonGitHub
02/19/2023, 11:42 AMGitHub
02/19/2023, 11:42 AMGitHub
02/19/2023, 11:51 AMGitHub
02/19/2023, 11:51 AMGitHub
02/19/2023, 12:01 PMGitHub
02/20/2023, 9:52 AM(
target
.given('there is an alligator named John',
params={'color':'green', 'weight_kg': 130, 'lenght_m': 1.95}
)
.given('there is an spider named Jack',
params={'color':'mostly black', 'weight_kg': 0.009, 'lenght_m': 0.05}
)
.expects_to_receive('an alligator message')
.with_content({'name': 'John', 'document_name': 'sample_document.doc'})
.with_metadata({'contentType': 'application/json',
'source': 'legacy_api',
'some-header': Term('\\d+-\\d+-\\d+T\\d+:\\d+:\\d+', '2022-02-15T20:16:01')})
)
It is also backwards compatible, in that it is possible to just pass a single state name.
pact-foundation/pact-pythonSteve Wilkinson
02/20/2023, 12:00 PMpact-python
to verify messages between a consumer and provider on an AWS SQS queue. What's the best way of using matchers in the consumer test? The problem is that if my expected message has matchers in it, my system under test can't parse the message as it doesn't understand the matchers. My workaround is to pass the message into the SUT as a serialized JSON string, using a custom serializer that converts the matcher objects into actual values. I'm new to Pact and I suspect I'm doing something wrong, is there a better way of doing this?
Example expected message:
expected_msg = {
"timestamp": Term(
matcher=Format.Regexes.timestamp.value,
generate=datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"),
),
"cat": {
"name": "Saffy",
"breed": "DomesticShorthair",
},
}
Steve Wilkinson
02/21/2023, 2:11 PMReceived request message: {"resource": "cats", "method": "POST", "timeReceived": "2023-02-21T13:39:16Z", "cat": {"name": "Saffy", "breed": "DomesticShorthair"}}
resource = cats, method = POST, time_received = 2023-02-21 13:39:16+00:00, cat = name='Saffy' breed=<CatBreed.DOMESTIC_SHORTHAIR: 'DomesticShorthair'>
----------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------
/home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
/home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/rubygems/version.rb:206:in `initialize': Malformed version number string d3ba3948430b8a34ca5def0991648290010bf021 (ArgumentError)
from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/rubygems/version.rb:196:in `new'
from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/rubygems/version.rb:196:in `new'
from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-message-0.11.1/lib/pact/message/cli.rb:26:in `update'
from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/app/pact-message.rb:28:in `<main>'
/home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
No value provided for required pact_files
Is it trying to validate the version number as a semantic version? If so is there a way to turn this off?
This is the code I use to initialize the message consumer pact object:
@pytest.fixture(scope="session")
def consumer_pact(request):
version = request.config.getoption("--publish-pact", None)
publish = True if version else False
branch = request.config.getoption("--branch-name", None)
pact: MessagePact = MessageConsumer(CONSUMER_NAME, branch=branch).has_pact_with(
provider=Provider(PROVIDER_NAME),
publish_to_broker=publish,
broker_base_url=PACT_BROKER_BASE,
broker_token=PACT_BROKER_TOKEN,
pact_dir=PACT_DIR,
version=version,
)
yield pact
Slackbot
02/21/2023, 2:11 PMGazal Gafoor
03/01/2023, 1:30 PMGitHub
03/02/2023, 8:08 AMe2e
directory with examples
. The e2e
directory has been deleted here #144
• Reformatted the file a bit to get rid of the horizontal scrolling
• Removed mention of Travis, which apparently has not been used by project for a very long time
• Replaced the broken links to the guides with others that will probably last longer
• Updated the Python versions of the pyenv examples
pact-foundation/pact-python
✅ All checks have passed
5/5 successful checksSteve Wilkinson
03/03/2023, 5:38 PMpact_url
kwarg in my call to MessageProvider.verify_with_broker
in order to verify against a specific pact, but it seems to be ignored. I always get this error: "pact.verify_wrapper.PactException: Pact urls or Pact broker required". What's the correct way to verify against a specific pact using pact-python?GitHub
03/05/2023, 12:46 AMGitHub
03/05/2023, 1:06 AMmissing_files
was set twice, the second time is not used
• provider_app_version
was set twice with the same value
• removed unnecessary brackets
• fix link for GitHub badge
pact-foundation/pact-python
✅ All checks have passed
7/7 successful checksGitHub
03/05/2023, 8:20 AM