Improve test coverage and handling of input and errors in Review UIs.

Review Request #10717 — Created Sept. 16, 2019 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x
3fa894f...

Reviewers

The Review UI support had pretty minimal tests, which meant that some
recent issues weren't caught earlier in Python 3.x development. The few
tests we did have for the core ReviewUI and FileAttachmentReviewUI
were more about the sandboxing of some calls, which didn't really help
as much of the sandboxing applied the wrong approach (ignoring faults in
subclasses, resulting in harder-to-diagnose issues, rather than outright
failing).

Sandboxing is important when common code is calling into
extension-provided code, but in these cases we were dealing with
extension-provided code (subclasses of ReviewUI) calling other
extension-provided code (overridden methods of that same ReviewUI).

This removes all the old testing code, adding new more comprehensive and
correct tests for ReviewUI and FileAttachmentReviewUI. These live in
the standard reviewboard.reviews.tests directory, rather than the more
buried reviewboard.reviews.ui.tests (which is no more). The existing
ImageReviewUI (which could still use additional work) has been moved
into reviewboard.reviews.tests as well.

There were a few changes made to ReviewUI as a result of the tests.
The inline parameter (intended for rendering a ReviewUI within
something like the diff viewer, but never fully used in practice) now
does a better job of processing input in a request, and
get_comments_json() no longer tries to mark the string as safe
(leaving that up to the template).

Unit tests pass.