pact-python
pact-python copied to clipboard
Pact broker support for the MessageProvider
As I understand, MessageProvider verifies pacts only for the given pacts directory .
Is there any way to achieve verification using pact-broker for the MessageProvider like using Verifier?
Thank you!
The verify method of the message provider is:
pact_files = f'{self.pact_dir}/{self._pact_file()}'
verifier = Verifier(provider=self.provider,
provider_base_url=self._proxy_url())
return_code, _ = verifier.verify_pacts(pact_files, verbose=False)
assert (return_code == 0), f'Expected returned_code = 0, actual = {return_code}'
Using that as guidance, I think that, as a workaround, you could create your own Verifier that checks pacts with a broker. Something like:
with provider:
verifier = Verifier(provider='UserService', provider_base_url=provider._proxy_url())
return_code, _ = verifier.verify_with_broker(**OPTIONS, verbose=False)
assert (return_code == 0), f'Expected return_code = 0, actual = {return_code}'
/cc @elliottmurray
I think this one can be closed, since it is solved in https://github.com/pact-foundation/pact-python/pull/257
/cc @elliottmurray @matthewbalvanz-wf