DescriptionSpit and polish on fake roundtrippers.
We have a facility to inject fake HTTP interactions in tests, but it's harder
to figure out and use than I think it needs to be. This branch:
* Renames VirtualRoundTripper to CannedRoundTripper, to reflect more
specifically that it returns canned responses. Still not great.
* Replaces the slice-of-structs-of-name-and-value way in which the
roundtripper stores canned responses with a simpler
map-of-names-to-contents.
* Hides the details of how a roundtripper is installed inside a helper
function.
* Documents how all this works, and in particular, a few nasty gotchas w.r.t.
how conflicting matches are handled.
* Extracts a factory for HTTP responses. I think it brings out the logic in
the caller more clearly, eliminating some repetition along the way.
* Gives me personally the chance to learn about a mechanism I'll be using
next.
https://code.launchpad.net/~jtv/juju-core/encapsulate-proxyroundtripper/+merge/177338
(do not edit description out of merge proposal)
Patch Set 1 #
Total comments: 13
Patch Set 2 : Spit and polish on fake roundtrippers. #
MessagesTotal messages: 7
|