Set initial repository subform values to fix PUTs via the API.

Review Request #10960 — Created March 20, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x

Reviewers

RepositoryForm does a lot of work to build and populate subforms, but
it wasn't complete. While the main RepositoryForm initial data was
populated by way of the parent ModelForm, the relevant subforms never
had their own initial data set, nor did they necessarily have the right
form data set from an existing instance.

This regressed the API. Performing an HTTP PUT on the repository
resource would error out unless name and path were explicitly
provided, since those model-level attributes never transitioned properly
to the subforms. We didn't have suitable test coverage for this, so it
wasn't noticed before

This change updates active subforms for an existing instance to have
their initial data for these model-level fields set properly. It also
improves the test suite just a bit to better catch some of this and to
leverage the built-in tests for PUT requests. More work still needs to
be done to better flesh out these tests, which will be handled in a
separate change.

All unit tests pass.

Commits

Files

    Loading...