Compare commits

...
2 changed files with 41 additions and 1 deletions

No files matched your search

@@ -66,7 +66,7 @@ def iter_manifest_records(path: Path) -> Generator[dict, None, None]:
"""Yield records one at a time from a manifest JSON array via ijson."""
try:
with path.open("rb") as f:
yield from ijson.items(f, "item")
yield from ijson.items(f, "item", use_float=True)
except ijson.JSONError as e:
raise CommandError(f"Failed to parse manifest file {path}: {e}") from e
@@ -50,6 +50,7 @@ from documents.settings import EXPORTER_FILE_NAME
from documents.settings import EXPORTER_SHARE_LINK_BUNDLE_NAME
from documents.settings import EXPORTER_THUMBNAIL_NAME
from documents.tests.utils import SampleDirMixin
from paperless.models import ApplicationConfiguration
from paperless_mail.models import MailAccount
from paperless_testing.assertions import FileSystemAssertsMixin
from paperless_testing.dirs import DirectoriesMixin
@@ -1402,6 +1403,45 @@ class TestCryptExportImport(
social_token = SocialToken.objects.first()
self.assertIsNotNone(social_token)
def test_import_passphrase_with_float_field(self) -> None:
"""
GIVEN:
- An application configuration with a float field set
WHEN:
- Export and import are run with a passphrase
THEN:
- The import succeeds and the float value is preserved
"""
ApplicationConfiguration.objects.update_or_create(
pk=1,
defaults={"rotate_pages_threshold": 12.5},
)
call_command(
"document_exporter",
"--no-progress-bar",
"--passphrase",
"securepassword",
self.target,
skip_checks=True,
)
ApplicationConfiguration.objects.all().delete()
call_command(
"document_importer",
"--no-progress-bar",
"--passphrase",
"securepassword",
self.target,
skip_checks=True,
)
self.assertEqual(
ApplicationConfiguration.objects.get().rotate_pages_threshold,
12.5,
)
def test_import_crypt_no_passphrase(self) -> None:
"""
GIVEN: