Fish Trophy

chipx86 got a fish trophy!

Fish Trophy

Change some HTML-related assertions to use assertHTMLEqual().

Review Request #9669 — Created Feb. 18, 2018 and submitted

Information

Djblets
release-1.0.x
e0b69c7...

Reviewers

We had some unit tests that were checking the HTML output of functions,
expecting certain attribute orders and whitespace. These were fine with
Django 1.6, but were changed in both newer versions of Django and could
be impacted by dictionary-related ordering in Python 3. The way to
safely check for HTML string equality is through Django's
assertHTMLEqual() (or assertInHTML()), which this change is making
more use of.

The assertions for ConditionsWidget required a bit more work than
simply switching the equality check. We were checking an entire
resulting dictionary at once, which performed strict string equality
checks. To address this, the tests had to be changed to check for each
of the fields in the dictionary (dealing with nested values in the
process) independently, so that we could assertHTMLEqual() the HTML
parts. This has the added benefit of helping trace specific regressions
in the output without having to manually compare large dictionaries in
test failure results.

Unit tests pass on Django 1.6 and 1.11 (when used with other in-progress
compatibility changes).

david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (1b2985e)
Loading...