Make test file attachments behave more like real file attachments.

Review Request #13236 — Created Aug. 27, 2023 and submitted

Information

Review Board
release-6.x

Reviewers

This change updates our test file attachments so that they behave more
like our real file attachments. We add a with_history argument to the
TestCase.create_file_attachment method, which defaults to creating an
associated file attachment history for the file attachment. This matches the
way that file attachments are created in production. This also fixes a
discrepancy between what initial revision number is used for attachments.
In production we always set the revision to 1, but in test cases this was
being set to 0. Finally, we automatically set the draft_caption of a test
file attachment to the caption, if no draft_caption was supplied.

The number of queries for some ReviewRequestPageData.query_data_post_etag
tests were reduced because the function call no longer leads to creating
a file attachment history for the involved file attachment.

In all, these changes allow us to easily create test file attachments in
the same way that they are created in production, and makes it easier to
create new revisions for test file attachments.

  • Ran unit tests.
  • Used this in upcoming changes.
Summary ID
Make test file attachments behave more like real file attachments.
b11a642ba207bbb0f7ada1b7832fcb577eb8a3a5
Description From Last Updated

Can you add a Version Added here and a Version Changed to the method description?

chipx86chipx86

No parens needed.

chipx86chipx86
david
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. reviewboard/testing/testcase.py (Diff revision 1)
     
     
     
     
     
     
     
    Show all issues

    Can you add a Version Added here and a Version Changed to the method description?

  3. reviewboard/testing/testcase.py (Diff revision 1)
     
     
    Show all issues

    No parens needed.

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

Status: Closed (submitted)

Change Summary:

Pushed to release-6.x (888922a)
Loading...