Add standard support for repository configuration subforms.
Review Request #10806 — Created Nov. 27, 2019 and submitted
RepositoryForm
has supported an idea of subforms for a while, focusing
exclusively on hosting service subforms. In an upcoming change, we'll be
introducing support forSCMTool
-provided subforms as well, and to
prepare for that, this change adds a common set of base classes for
subforms that will be used for all repository-related subforms.The top-most base class,
BaseRepositorySubForm
, adds the main support
for loading values for fields, setting overridden help text and labels,
defining common attributes for use by subclasses, and adding an
interface method for saving state back out to an object.This is further subclassed by
BaseRepositoryAuthSubForm
and
BaseRepositoryInfoSubForm
, which form the bases for
HostingServiceAuthForm
andHostingServiceForm
, respectively. They
don't currently provide any additional functionality beyond
BaseRepositorySubForm
, but are there for some future expansion plans
that will take place post-4.0 sometime with the new repository
configuration UI.The hosting service forms are a bit slimmer now, as they no longer need
to perform some of the operations now covered in the base classes. Along
with this, better documentation has been added.This does change the requirements for instantiating these forms, but
this shouldn't affect any properly-written forms that safely pass on
arguments in a custom__init__
. Care has been taken to not break the
load()
orsave()
function signatures, though therepository
arguments passed to both are pending deprecation.Unit tests have been enhanced to better check any state loaded from or
saved to a repository by the form.
All unit tests pass.
Configured some repositories and verified that hosting service state
was loading and saving properly.Tested the hosting service authentication workflow, with and without
two-factor authentication. Tested re-linking with new credentials.