Improve test coverage and handling of input and errors in Review UIs.
Review Request #10717 — Created Sept. 16, 2019 and submitted
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.
Description | From | Last Updated |
---|---|---|
F401 'django.test.client.RequestFactory' imported but unused |
reviewbot | |
F841 local variable 'attachment1' is assigned to but never used |
reviewbot | |
F841 local variable 'attachment3' is assigned to but never used |
reviewbot | |
F841 local variable 'draft' is assigned to but never used |
reviewbot | |
F821 undefined name 'has_usable_review_ui' |
reviewbot | |
F401 'django.test.client.RequestFactory' imported but unused |
reviewbot | |
F401 'djblets.testing.decorators.add_fixtures' imported but unused |
reviewbot | |
F401 'reviewboard.reviews.models.Review' imported but unused |
reviewbot | |
F401 'reviewboard.reviews.ui.base.register_ui' imported but unused |
reviewbot | |
F401 'reviewboard.reviews.ui.base.unregister_ui' imported but unused |
reviewbot | |
E265 block comment should start with '# ' |
reviewbot | |
E265 block comment should start with '# ' |
reviewbot |
- Change Summary:
-
Fixed a whole bunch of sloppiness on my part leading to Review Bot complaints.
- Commit:
-
a2313aeae76ac555630210332cde92d1cc4d4fd13fa894f31223b8dc6c0e6288e08193c2dab1fe53
- Diff:
-
Revision 2 (+829 -295)