Further testing and examples

This commit is contained in:
Trenton H
2024-10-02 11:13:23 -07:00
parent 25a4d61391
commit 0c5d8f6ff3
2 changed files with 20 additions and 3 deletions

View File

@@ -1289,3 +1289,22 @@ class TestFilenameGeneration(DirectoriesMixin, TestCase):
generate_filename(doc_a),
"not-invoices/Some Title.pdf",
)
def test_using_other_filters(self):
doc_a = Document.objects.create(
title="Some Title",
created=timezone.make_aware(datetime.datetime(2020, 6, 25, 7, 36, 51, 153)),
added=timezone.make_aware(datetime.datetime(2024, 10, 1, 7, 36, 51, 153)),
mime_type="application/pdf",
pk=2,
checksum="2",
archive_serial_number=25,
)
with override_settings(
FILENAME_FORMAT="{% if document.correspondent %}{{ document.correspondent.name }}{% else %}No Correspondent{% endif %}/{title}",
):
self.assertEqual(
generate_filename(doc_a),
"No Correspondent/Some Title.pdf",
)