Update the GerritForm.clean() tests for cross-Django compatibility.

Review Request #10619 — Created July 8, 2019 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x
bf3f299...

Reviewers

GerritForm.clean() attempts to set a gerrit_domain key based on the
gerrit_url that is provided, but otherwise doesn't perform any other
changes to the cleaned data. We had a unit test that checked that the
cleaned data (including domain) contained the values we expected, but
this posed problems on modern versions of Django, as the URLField used
for gerrit_url differed in its return value (the Django 1.6 version
includes a trailing slash while the 1.11 version does not).

Rather than attempting to normalize the version in the test, or key off
expected values by version, we're instead changing the purpose of the
test. It no longer checks the entirety of the cleaned data, but rather
is checking that gerrit_domain is properly set based off gerrit_url.
This avoids checking Django-specific results, sets a precedent in these
tests to have more specific unit tests for any custom keys added going
forward.

Unit tests pass on Django 1.6 and 1.11.

    Loading...