Skip to content

Commit 6f0d3ac

Browse files
committed
docs: Example code verifier
1 parent 9c01e99 commit 6f0d3ac

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,11 @@ For more information see [Matching](https://docs.pact.io/getting_started/matchin
293293
## Verifying Pacts Against a Service
294294

295295
In addition to writing Pacts for Python consumers, you can also verify those Pacts
296-
against a provider of any language. After installing pact-python a `pact-verifier`
296+
against a provider of any language. There are two ways to do this.
297+
298+
### CLI
299+
300+
After installing pact-python a `pact-verifier`
297301
application should be available. To get details about its use you can call it with the
298302
help argument:
299303

@@ -357,6 +361,18 @@ as the environment variable `PACT_BROKER_PASSWORD`.
357361
The bearer token to use when contacting the Pact Broker. You can also specify this value
358362
as the environment variable `PACT_BROKER_TOKEN`.
359363

364+
### Python API
365+
You can use the Verifier class. This has all the same parameters as the cli tool but allows you to write native python code and the test framework of your choice.
366+
367+
```python
368+
verifier = Verifier(provider='UserService',
369+
provider_base_url=PACT_URL)
370+
371+
output, logs = verifier.verify_pacts('./userserviceclient-userservice.json')
372+
373+
```
374+
You can see more details in the e2e example.
375+
360376
### Provider States
361377
In many cases, your contracts will need very specific data to exist on the provider
362378
to pass successfully. If you are fetching a user profile, that user needs to exist,

0 commit comments

Comments
 (0)