Fix diff error bundle using wrong string type on Python 3.

Review Request #11960 — Created Jan. 21, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

This change fixes bug #4958 by changing zipfile in
DownloadPatchErrorBundleView to use BytesIO instead of StringIO, which
makes it work on both Python 2 and 3. Before this change, the view would fail
when Python 3 was used.

This change also adds two unit tests for DownloadPatchErrorBundleView that test
its response when there is or isn't a PatchError raised in rendering the diff.

A review request with a patch that does not apply cleanly was created.
The patch error bundle was successfully downloaded when running
the Review Board dev server on both Python 2 and 3.

Two unit tests were added for DownloadPatchErrorBundleView that test its
responses. It was verified that these unit tests fail on release-4.0.x
when Python 3 is used, and pass on both Python 2 and 3 after this change.

All unit tests in reviewboard.diffviewer.tests were run and passed on
both Python 2 and 3.

Changes between revision 2 and 3

orig
1
2
3
4

Commits

Summary ID Author
Fix diff error bundle using wrong string type on Python 3.
This commit fixes bug #4958 by changing `zipfile` in `DownloadPatchErrorBundleView` to use `BytesIO` instead of `StringIO`, which makes it work on both Python 2 and 3.
a46e017b48b5be34cab00737f9d5b7d113fa19a0 Kyle McLean
Add unit tests for DownloadPatchErrorBundleView.
Adds test_sends_404_when_no_patch_error and test_sends_bundle_when_patch_error unit tests, which test the responses of DownloadPatchErrorBundleView.
7cfc46ace886a3ed31b2647a2f844470ca068725 Kyle McLean
Add unit tests for DownloadPatchErrorBundleView.
Adds test_sends_404_when_no_patch_error and test_sends_bundle_when_patch_error unit tests, which test the responses of DownloadPatchErrorBundleView.
fc4da4c6e8c34ed53c8ffe65dcea63452f524088 Kyle McLean
reviewboard/diffviewer/tests/test_download_patch_error_bundle_view.py
Loading...