~axwalk/juju-core/trunk

Viewing all changes in revision 1552.

[r=jtv] Spit 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.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: