Improve test coverage and handling of input and errors in Review UIs.
Review Request #10717 — Created Sept. 16, 2019 and submitted — Latest diff uploaded
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 coreReviewUI
andFileAttachmentReviewUI
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 ofReviewUI
) calling other
extension-provided code (overridden methods of that sameReviewUI
).This removes all the old testing code, adding new more comprehensive and
correct tests forReviewUI
andFileAttachmentReviewUI
. These live in
the standardreviewboard.reviews.tests
directory, rather than the more
buriedreviewboard.reviews.ui.tests
(which is no more). The existing
ImageReviewUI
(which could still use additional work) has been moved
intoreviewboard.reviews.tests
as well.There were a few changes made to
ReviewUI
as a result of the tests.
Theinline
parameter (intended for rendering aReviewUI
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.