Improve testing capabilities and reporting for hosting services.

Review Request #10633 — Created July 19, 2019 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x
532c5ac...

Reviewers

Hosting service unit tests are now able to better catch calls and
compare them to expected results in a way that provides better
information when those expectations don't match up.

We now spy on all relevant hosting service client methods through the
hosting service's client class, rather than a mix of the client instance
and the top-level HostingServiceClient class. This limits the scope of
our spies in cases where the service defines its own client class, but
also allow us to catch calls that may come from a different instance of
the client (such as when a backend instantiates it through a view that
we're accessing through the Django HTTP test client).

When asserting results of the HTTP calls, we no longer rely on just the
results of the http_request() method. We instead check the URL,
method, and POST/PUT body against what comes back from
build_http_request(). This allows us to more thoroughly test in the
event that this data gets modified by part of the HTTP machinery on the
client.

If any of the expectations during the assertion fail, a better error
message and stack trace will now be provided, helping to debug the
source of the problem. Previously, the data had to be printed and
scrutinized, making it harder to see how things broke.

All hosting service unit tests pass.