pact-ruby

How do I verify pacts against an API that requires an auth token?

旧巷老猫 提交于 2019-12-02 06:29:51
问题 I'm using the Pact gem (and loving it!) for my contract test suite. The API service I'm testing requires an authorization token for all requests. I know how to generate an API token for my user, but I don't know where to place the token in the Pact workflow. I searched the Pact documentation and repo for examples but didn't have any luck. I tried sending a POST in the consumer specs to generate a token, but the Pact mock server doesn't know what to do with the request and errors out (as I

How do I verify pacts against an API that requires an auth token?

大城市里の小女人 提交于 2019-12-02 00:14:27
I'm using the Pact gem (and loving it!) for my contract test suite. The API service I'm testing requires an authorization token for all requests. I know how to generate an API token for my user, but I don't know where to place the token in the Pact workflow. I searched the Pact documentation and repo for examples but didn't have any luck. I tried sending a POST in the consumer specs to generate a token, but the Pact mock server doesn't know what to do with the request and errors out (as I would expect). I found this example and it seems promising, particularly the ability to assign predefined