mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-16 00:36:22 +00:00
Sets the timezone of creation, if the date is known and naive
This commit is contained in:
@@ -3,6 +3,11 @@ import os
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
try:
|
||||
import zoneinfo
|
||||
except ImportError:
|
||||
from backports import zoneinfo
|
||||
|
||||
from django.test import TestCase
|
||||
from django.test import override_settings
|
||||
from httpx import Request
|
||||
@@ -21,6 +26,7 @@ class TestTikaParser(HttpxMockMixin, TestCase):
|
||||
def tearDown(self) -> None:
|
||||
self.parser.cleanup()
|
||||
|
||||
@override_settings(TIME_ZONE="America/Chicago")
|
||||
def test_parse(self):
|
||||
# Pretend parse response
|
||||
self.httpx_mock.add_response(
|
||||
@@ -44,7 +50,15 @@ class TestTikaParser(HttpxMockMixin, TestCase):
|
||||
with open(self.parser.archive_path, "rb") as f:
|
||||
self.assertEqual(f.read(), b"PDF document")
|
||||
|
||||
self.assertEqual(self.parser.date, datetime.datetime(2020, 11, 21))
|
||||
self.assertEqual(
|
||||
self.parser.date,
|
||||
datetime.datetime(
|
||||
2020,
|
||||
11,
|
||||
21,
|
||||
tzinfo=zoneinfo.ZoneInfo("America/Chicago"),
|
||||
),
|
||||
)
|
||||
|
||||
def test_metadata(self):
|
||||
self.httpx_mock.add_response(
|
||||
|
Reference in New Issue
Block a user