Fix form validation and communication problems with Gerrit.
Review Request #9872 — Created April 13, 2018 and submitted
The new Gerrit support was originally written and tested with an older
version of Gerrit, which used HTTP Digest Auth. Newer versions now use
Basic Auth exclusively, which prevented any communication with the API.
Adding both a pre-filled Basic Auth header and registering for Digest
Auth enables us to support both.
There was also a problem with the repository form. If any validation
errors were hit with the URL, the page would crash, since
assuming the presence of a cleaned URL. This is now checked for presence
before basing anything off the URL.
Unit tests were added for these scenarios.
Manually tested with Gerrit 2.13.11 (last to support Digest Auth) and
2.4.13 (which uses Basic Auth) to ensure that accounts could be linked,
repositories saved, and files fetched.
Manually tested the form with invalid URLs to make sure a valid error
was shown, instead of the page crashing.
Unit tests pass.