Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque authored Jun 25, 2017
1 parent c86b3a0 commit f5a5958
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,25 @@ SomethingLike(123) # Matches if the value is an integer
SomethingLike('hello world') # Matches if the value is a string
SomethingLike(3.14) # Matches if the value is a float
```

The argument supplied to `SomethingLike` will be what the mock service responds with.

### EachLike(matcher, minimum=None, maximum=None)
When a dictionary is used as an argument for SomethingLike, all the child objects (and their child objects etc.) will be matched according to their types, unless you use a more specific matcher like a Term.

```python
SomethingLike({
'username': Term('[a-zA-Z]+', 'username'),
'id': 123, # integer
'confirmed': false, # boolean
'address': { # dictionary
'street': '200 Bourke St' # string
}
})

```

### EachLike(matcher, minimum=1)
Asserts the value is an array type that consists of elements
like the ones passed in. It can be used to assert simple arrays:
like the one passed in. It can be used to assert simple arrays:

```python
from pact import EachLike
Expand All @@ -184,7 +197,7 @@ Or other matchers can be nested inside to assert more complex objects:
from pact import EachLike, SomethingLike, Term
EachLike({
'username': Term('[a-zA-Z]+', 'username'),
'id': SomethingLike(123),
'id': 123,
'groups': EachLike('administrators')
})
```
Expand Down Expand Up @@ -229,13 +242,13 @@ or one or more local paths, separated by a comma.

###### --provider-states-url

The URL where your provider application will produce the list of available provider states.
_DEPRECATED AFTER v 0.6.0._ The URL where your provider application will produce the list of available provider states.
The verifier calls this URL to ensure the Pacts specify valid states before making the HTTP
requests.

###### --provider-states-setup-url

The URL which should be called to setup a specific provider state before a Pact is verified.
The URL which should be called to setup a specific provider state before a Pact is verified. This URL will be called with a POST request, and the JSON body `{consumer: 'Consumer name', states: ['a thing exists']}`. Note that the current pact specification version (v2) only supports a single provider state, however, v3 will support multiple states, and the set-up call is designed to be forwards compatible with the planned change.

###### --pact-broker-username

Expand All @@ -255,7 +268,7 @@ states to communicate from the consumer what data should exist on the provider.

When setting up the testing of a provider you will also need to setup the management of
these provider states. The Pact verifier does this by making additional HTTP requests to
the `provider_states_url` and `provider_states_setup_url` you provide. These URLs could be
the `provider_states_setup_url` you provide. This URL could be
on the provider application or a separate one. Some strategies for managing state include:

- Having endpoints in your application that are not active in production that create and delete your datastore state
Expand Down

0 comments on commit f5a5958

Please sign in to comment.