Make test file attachments behave more like real file attachments.
Review Request #13236 — Created Aug. 27, 2023 and submitted — Latest diff uploaded
This change updates our test file attachments so that they behave more
like our real file attachments. We add awith_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 to1
, but in test cases this was
being set to0
. Finally, we automatically set thedraft_caption
of a test
file attachment to thecaption
, if nodraft_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.