Make test file attachments behave more like real file attachments.
Review Request #13236 — Created Aug. 27, 2023 and submitted
This change updates our test file attachments so that they behave more
like our real file attachments. We add a
with_historyargument to the
TestCase.create_file_attachmentmethod, 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_captionof a test
file attachment to the
caption, if no
The number of queries for some
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.
Revision 2 (+114 -82)
Checks run (2 succeeded)