mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-09-21 08:58:31 +00:00
Chore: Remove unused test helpers
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import shutil
|
||||
import zoneinfo
|
||||
from collections.abc import Generator
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
@@ -117,11 +116,6 @@ def _search_index(
|
||||
reset_backend()
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def settings_timezone(settings: Settings) -> zoneinfo.ZoneInfo:
|
||||
return zoneinfo.ZoneInfo(settings.TIME_ZONE)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def rest_api_client():
|
||||
"""
|
||||
|
||||
@@ -196,20 +196,6 @@ class FileSystemAssertsMixin:
|
||||
def assertIsNotDir(self, path: PathLike[str] | str) -> None:
|
||||
self.assertFalse(Path(path).resolve().is_dir(), f"Dir does exist: {path}")
|
||||
|
||||
def assertFilesEqual(
|
||||
self,
|
||||
path1: PathLike[str] | str,
|
||||
path2: PathLike[str] | str,
|
||||
) -> None:
|
||||
path1 = Path(path1)
|
||||
path2 = Path(path2)
|
||||
import hashlib
|
||||
|
||||
hash1 = hashlib.sha256(path1.read_bytes()).hexdigest()
|
||||
hash2 = hashlib.sha256(path2.read_bytes()).hexdigest()
|
||||
|
||||
self.assertEqual(hash1, hash2, "File SHA256 mismatch")
|
||||
|
||||
def assertFileCountInDir(self, path: PathLike[str] | str, count: int) -> None:
|
||||
path = Path(path).resolve()
|
||||
self.assertTrue(path.is_dir(), f"Path {path} is not a directory")
|
||||
@@ -221,24 +207,6 @@ class FileSystemAssertsMixin:
|
||||
)
|
||||
|
||||
|
||||
class ConsumerProgressMixin:
|
||||
"""
|
||||
Mocks the Consumer _send_progress, preventing attempts to connect to Redis
|
||||
and allowing access to its calls for verification
|
||||
"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
self.send_progress_patcher = mock.patch(
|
||||
"documents.consumer.Consumer._send_progress",
|
||||
)
|
||||
self.send_progress_mock = self.send_progress_patcher.start()
|
||||
super().setUp()
|
||||
|
||||
def tearDown(self) -> None:
|
||||
super().tearDown()
|
||||
self.send_progress_patcher.stop()
|
||||
|
||||
|
||||
class ConsumeTaskMixin:
|
||||
"""
|
||||
Provides mocking of the consume_file asynchronous task and useful utilities
|
||||
@@ -282,7 +250,6 @@ class TestMigrations(TransactionTestCase):
|
||||
migrate_from = None
|
||||
dependencies = None
|
||||
migrate_to = None
|
||||
auto_migrate = True
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
@@ -304,10 +271,6 @@ class TestMigrations(TransactionTestCase):
|
||||
|
||||
self.apps = old_apps
|
||||
|
||||
if self.auto_migrate:
|
||||
self.performMigration()
|
||||
|
||||
def performMigration(self) -> None:
|
||||
# Run the migration to test
|
||||
executor = MigrationExecutor(connection)
|
||||
executor.loader.build_graph() # reload.
|
||||
|
||||
Reference in New Issue
Block a user