-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a ClientController test utility (#155)
With `StubClient` the responsibilities for checking arguments and stubbing return values are overloaded to an `EqualityMap` checking the full content of the Uri and JSON payload and using it as a key to choose a stubbed response. This is verbose; details are repeated in every test that are not relevant to the test. It also has hard to diagnose failures; when an argument is incorrect it surfaces as a missing key with no hint about what value in the payload is wrong. Add a `ClientController` class which more directly addresses stubbing and argument checking individually. When only stubbing is necessary the `verifyRequest` argument can be omitted, and any request gets the stubbed response. Expectations checked against the request URI and JSON payload can be as shallow or deep as necessary for the given test. Add an `arbitraryGenerateContentResponse` variable to fill in for responses where the parsed output isn't tested.
- Loading branch information
Showing
4 changed files
with
344 additions
and
895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.