Skip to content

Commit 65b493d

Browse files
Merge pull request #33 from bethesque/reamde
Update README.md
2 parents b8f2dde + f5a5958 commit 65b493d

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,25 @@ SomethingLike(123) # Matches if the value is an integer
165165
SomethingLike('hello world') # Matches if the value is a string
166166
SomethingLike(3.14) # Matches if the value is a float
167167
```
168-
169168
The argument supplied to `SomethingLike` will be what the mock service responds with.
170169

171-
### EachLike(matcher, minimum=None, maximum=None)
170+
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.
171+
172+
```python
173+
SomethingLike({
174+
'username': Term('[a-zA-Z]+', 'username'),
175+
'id': 123, # integer
176+
'confirmed': false, # boolean
177+
'address': { # dictionary
178+
'street': '200 Bourke St' # string
179+
}
180+
})
181+
182+
```
183+
184+
### EachLike(matcher, minimum=1)
172185
Asserts the value is an array type that consists of elements
173-
like the ones passed in. It can be used to assert simple arrays:
186+
like the one passed in. It can be used to assert simple arrays:
174187

175188
```python
176189
from pact import EachLike
@@ -184,7 +197,7 @@ Or other matchers can be nested inside to assert more complex objects:
184197
from pact import EachLike, SomethingLike, Term
185198
EachLike({
186199
'username': Term('[a-zA-Z]+', 'username'),
187-
'id': SomethingLike(123),
200+
'id': 123,
188201
'groups': EachLike('administrators')
189202
})
190203
```
@@ -229,13 +242,13 @@ or one or more local paths, separated by a comma.
229242

230243
###### --provider-states-url
231244

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

236249
###### --provider-states-setup-url
237250

238-
The URL which should be called to setup a specific provider state before a Pact is verified.
251+
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.
239252

240253
###### --pact-broker-username
241254

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

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

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

0 commit comments

Comments
 (0)