You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-7Lines changed: 20 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,12 +165,25 @@ SomethingLike(123) # Matches if the value is an integer
165
165
SomethingLike('hello world') # Matches if the value is a string
166
166
SomethingLike(3.14) # Matches if the value is a float
167
167
```
168
-
169
168
The argument supplied to `SomethingLike` will be what the mock service responds with.
170
169
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)
172
185
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:
174
187
175
188
```python
176
189
from pact import EachLike
@@ -184,7 +197,7 @@ Or other matchers can be nested inside to assert more complex objects:
184
197
from pact import EachLike, SomethingLike, Term
185
198
EachLike({
186
199
'username': Term('[a-zA-Z]+', 'username'),
187
-
'id': SomethingLike(123),
200
+
'id': 123,
188
201
'groups': EachLike('administrators')
189
202
})
190
203
```
@@ -229,13 +242,13 @@ or one or more local paths, separated by a comma.
229
242
230
243
###### --provider-states-url
231
244
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.
233
246
The verifier calls this URL to ensure the Pacts specify valid states before making the HTTP
234
247
requests.
235
248
236
249
###### --provider-states-setup-url
237
250
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.
239
252
240
253
###### --pact-broker-username
241
254
@@ -255,7 +268,7 @@ states to communicate from the consumer what data should exist on the provider.
255
268
256
269
When setting up the testing of a provider you will also need to setup the management of
257
270
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
259
272
on the provider application or a separate one. Some strategies for managing state include:
260
273
261
274
- Having endpoints in your application that are not active in production that create and delete your datastore state
0 commit comments