Add a new hosting service HTTP request builder function for credentials.
Review Request #10636 — Created July 19, 2019 and submitted — Latest diff uploaded
HostingServiceClient.get_http_credentials(), which is
responsible for returning the credentials used to authenticate with the
hosting service. It takes in the username/password provided in the
request (if any), along with any other request arguments, and returns a
dictionary that will be passed down into
By default, this will return the account username and password (if an
passwordkey exists in the account data), which
build_http_request()will use for Basic or Digest auth (if enabled on
the client). Subclasses are free to handle those credentials however
they want, though.
Alternatively, it can return a
headerskey in the credentials
dictionary, and all headers will be added to the request. This allows
for a custom
Authorizationheader, or some other header used for that
This takes care of one of the more common cases for overriding
build_http_request(), and simplifies unit testing.
Unit tests can more easily test against the credentials as well, either
using the already-supported
assertHTTPCall(), or by passing in a
the full dictionary.
RB Gateway has been updated to take advantage of this new support.
Unit tests pass.
Tested that I can link an account with RB Gateway.