The below test will pass correctly, but if I post a body of {"a different key" : 4.56}
it will fail as "key" is expected. In other words, the dictionary key is not flexible, only the float value.
How can I define a pact where only the dictionary types matter i.e. keys must be strings, value must be floats? The docs don't make this clear: https://github.com/pact-foundation/pact-python
def test_case_1(pact, client):
(
pact.given("object does not exist")
.upon_receiving("a new post request")
.with_request(
"post",
"/url/post/endpoint",
body=Like({"key": 1.23})
.will_respond_with(200, body={})
)
with pact:
client.post(body={"key": 4.56})