mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-16 21:55:37 -05:00
Development: fix localization failing tests (#10840)
--------- Co-authored-by: Trenton H <797416+stumpylog@users.noreply.github.com>
This commit is contained in:
@@ -18,14 +18,17 @@ class TestDocument(TestCase):
|
|||||||
self.originals_dir = tempfile.mkdtemp()
|
self.originals_dir = tempfile.mkdtemp()
|
||||||
self.thumb_dir = tempfile.mkdtemp()
|
self.thumb_dir = tempfile.mkdtemp()
|
||||||
|
|
||||||
override_settings(
|
self.overrides = override_settings(
|
||||||
ORIGINALS_DIR=self.originals_dir,
|
ORIGINALS_DIR=self.originals_dir,
|
||||||
THUMBNAIL_DIR=self.thumb_dir,
|
THUMBNAIL_DIR=self.thumb_dir,
|
||||||
).enable()
|
)
|
||||||
|
|
||||||
|
self.overrides.enable()
|
||||||
|
|
||||||
def tearDown(self) -> None:
|
def tearDown(self) -> None:
|
||||||
shutil.rmtree(self.originals_dir)
|
shutil.rmtree(self.originals_dir)
|
||||||
shutil.rmtree(self.thumb_dir)
|
shutil.rmtree(self.thumb_dir)
|
||||||
|
self.overrides.disable()
|
||||||
|
|
||||||
def test_file_deletion(self):
|
def test_file_deletion(self):
|
||||||
document = Document.objects.create(
|
document = Document.objects.create(
|
||||||
|
@@ -97,12 +97,6 @@ class TestArchiver(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class TestDecryptDocuments(FileSystemAssertsMixin, TestCase):
|
class TestDecryptDocuments(FileSystemAssertsMixin, TestCase):
|
||||||
@override_settings(
|
|
||||||
ORIGINALS_DIR=(Path(__file__).parent / "samples" / "originals"),
|
|
||||||
THUMBNAIL_DIR=(Path(__file__).parent / "samples" / "thumb"),
|
|
||||||
PASSPHRASE="test",
|
|
||||||
FILENAME_FORMAT=None,
|
|
||||||
)
|
|
||||||
@mock.patch("documents.management.commands.decrypt_documents.input")
|
@mock.patch("documents.management.commands.decrypt_documents.input")
|
||||||
def test_decrypt(self, m):
|
def test_decrypt(self, m):
|
||||||
media_dir = tempfile.mkdtemp()
|
media_dir = tempfile.mkdtemp()
|
||||||
@@ -111,12 +105,12 @@ class TestDecryptDocuments(FileSystemAssertsMixin, TestCase):
|
|||||||
originals_dir.mkdir(parents=True, exist_ok=True)
|
originals_dir.mkdir(parents=True, exist_ok=True)
|
||||||
thumb_dir.mkdir(parents=True, exist_ok=True)
|
thumb_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
override_settings(
|
with override_settings(
|
||||||
ORIGINALS_DIR=originals_dir,
|
ORIGINALS_DIR=originals_dir,
|
||||||
THUMBNAIL_DIR=thumb_dir,
|
THUMBNAIL_DIR=thumb_dir,
|
||||||
PASSPHRASE="test",
|
PASSPHRASE="test",
|
||||||
).enable()
|
FILENAME_FORMAT=None,
|
||||||
|
):
|
||||||
doc = Document.objects.create(
|
doc = Document.objects.create(
|
||||||
checksum="82186aaa94f0b98697d704b90fd1c072",
|
checksum="82186aaa94f0b98697d704b90fd1c072",
|
||||||
title="wow",
|
title="wow",
|
||||||
|
@@ -3410,8 +3410,8 @@ class TestDateWorkflowLocalization(
|
|||||||
w.actions.add(action)
|
w.actions.add(action)
|
||||||
w.save()
|
w.save()
|
||||||
|
|
||||||
settings.SCRATCH_DIR = tmp_path / "scratch"
|
|
||||||
(tmp_path / "scratch").mkdir(parents=True, exist_ok=True)
|
(tmp_path / "scratch").mkdir(parents=True, exist_ok=True)
|
||||||
|
(tmp_path / "thumbnails").mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Temporarily override "now" for the environment so templates using
|
# Temporarily override "now" for the environment so templates using
|
||||||
# added/created placeholders behave as if it's a different system date.
|
# added/created placeholders behave as if it's a different system date.
|
||||||
@@ -3424,6 +3424,10 @@ class TestDateWorkflowLocalization(
|
|||||||
"django.utils.timezone.now",
|
"django.utils.timezone.now",
|
||||||
return_value=self.TEST_DATETIME,
|
return_value=self.TEST_DATETIME,
|
||||||
),
|
),
|
||||||
|
override_settings(
|
||||||
|
SCRATCH_DIR=tmp_path / "scratch",
|
||||||
|
THUMBNAIL_DIR=tmp_path / "thumbnails",
|
||||||
|
),
|
||||||
):
|
):
|
||||||
tasks.consume_file(
|
tasks.consume_file(
|
||||||
ConsumableDocument(
|
ConsumableDocument(
|
||||||
|
Reference in New Issue
Block a user