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

Review Request #1691 — Created July 11, 2019 and updated

guest901
Review Board
5d900f9...
test
`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.

Testing Done:
Unit tests pass on Django 1.6 and 1.11.

Reviewed at https://reviews.reviewboard.org/r/10619/


Loading...