mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-18 22:08:14 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09e37111a9 | ||
|
|
c6f83cc1a0 |
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."""
|
"""Yield records one at a time from a manifest JSON array via ijson."""
|
||||||
try:
|
try:
|
||||||
with path.open("rb") as f:
|
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:
|
except ijson.JSONError as e:
|
||||||
raise CommandError(f"Failed to parse manifest file {path}: {e}") from 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_SHARE_LINK_BUNDLE_NAME
|
||||||
from documents.settings import EXPORTER_THUMBNAIL_NAME
|
from documents.settings import EXPORTER_THUMBNAIL_NAME
|
||||||
from documents.tests.utils import SampleDirMixin
|
from documents.tests.utils import SampleDirMixin
|
||||||
|
from paperless.models import ApplicationConfiguration
|
||||||
from paperless_mail.models import MailAccount
|
from paperless_mail.models import MailAccount
|
||||||
from paperless_testing.assertions import FileSystemAssertsMixin
|
from paperless_testing.assertions import FileSystemAssertsMixin
|
||||||
from paperless_testing.dirs import DirectoriesMixin
|
from paperless_testing.dirs import DirectoriesMixin
|
||||||
@@ -1402,6 +1403,45 @@ class TestCryptExportImport(
|
|||||||
social_token = SocialToken.objects.first()
|
social_token = SocialToken.objects.first()
|
||||||
self.assertIsNotNone(social_token)
|
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:
|
def test_import_crypt_no_passphrase(self) -> None:
|
||||||
"""
|
"""
|
||||||
GIVEN:
|
GIVEN:
|
||||||
|
|||||||
Reference in new issue
Block a user