]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
add test for filename expectation with modified timezone
authorOliver Lippert <info@trusty.codes>
Sun, 1 May 2022 06:41:38 +0000 (08:41 +0200)
committerOliver Lippert <info@trusty.codes>
Sun, 1 May 2022 06:41:38 +0000 (08:41 +0200)
Signed-off-by: Oliver Lippert <info@trusty.codes>
#267

src/documents/tests/test_document_model.py

index a99d6dd18e0030f7d58ea62fa36680f9fbca02bb..bea8b6b91e35929dbd4e9f03ffa5bc1533974af6 100644 (file)
@@ -3,6 +3,7 @@ import tempfile
 from pathlib import Path
 from unittest import mock
 
+import pytz
 from django.test import override_settings
 from django.test import TestCase
 from django.utils import timezone
@@ -55,6 +56,24 @@ class TestDocument(TestCase):
         )
         self.assertEqual(doc.get_public_filename(), "2020-12-25 test.pdf")
 
+    def test_file_name_with_timezone(self):
+
+        doc = Document(
+            mime_type="application/pdf",
+            title="test",
+            created=timezone.datetime(
+                2020,
+                12,
+                25,
+                0,
+                0,
+                0,
+                0,
+                pytz.timezone("Europe/Berlin"),
+            ),
+        )
+        self.assertEqual(doc.get_public_filename(), "2020-12-25 test.pdf")
+
     def test_file_name_jpg(self):
 
         doc = Document(