Benjamín Earle
03/21/2023, 7:41 PMget
endpoint for that entity. I need to create it first so that the endpoint doesn't return a 404.
I have created a provider state setup function in my API, that creates this entity and returns a dictionary with the relevant value for the generator.
I am using the docker pact-cli for verifying the provider, and it is calling that endpoint correctly. My issue is that it is not modifying the pact to use the returned id instead of the example specified in the pact. Here's an example of my code:
// Consumer in JavaScript
provider
.given("an existing experiment")
.uponReceiving("a request to get the experiment")
.withRequest({
method: "GET",
path: fromProviderState("/v3/experiments/${uuid}", `/v3/experiments/${exampleUuid}`),
})
.willRespondWith({
status: 200,
body: { resource: like({
uuid: fromProviderState("${uuid}, exampleUuid)
})},
}));
# Provider state setup endpoint (Python & FastApi)
@router.get(/pact/setup)
def pact_setup():
experiment = create_experiment()
return { "uuid": experiment.uuid }
The setup function is being called by the docker verifier, returning the uuid of the created experiment, but the provider verification is still executing a get request to the exampleUuid
. Is there anything I'm missing?Benjamín Earle
03/21/2023, 8:05 PMTimothy Jones
03/21/2023, 10:38 PMTimothy Jones
03/21/2023, 10:39 PMMatt (pactflow.io / pact-js / pact-go)
Timothy Jones
03/21/2023, 10:49 PMBenjamín Earle
03/22/2023, 1:35 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Benjamín Earle
03/22/2023, 3:17 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Benjamín Earle
03/22/2023, 2:50 PM