bugfix, more tests
This commit is contained in:
1 parent
822c8ac24f
commit
6e332674a4
3 files changed
+12
-3
No files matched your search
@@ -56,10 +56,15 @@ class Command(Renderable, BaseCommand):
|
||||
manifest[index]["fields"]["storage_type"] = Document.STORAGE_TYPE_UNENCRYPTED # NOQA: E501
|
||||
|
||||
document = document_map[document_dict["pk"]]
|
||||
document.storage_type = Document.STORAGE_TYPE_UNENCRYPTED
|
||||
|
||||
if settings.PAPERLESS_FILENAME_FORMAT:
|
||||
# set storagy type temporarily for filename generation
|
||||
storage_type_actual = document.storage_type
|
||||
|
||||
document.storage_type = Document.STORAGE_TYPE_UNENCRYPTED
|
||||
name = generate_filename(document)
|
||||
|
||||
document.storage_type = storage_type_actual
|
||||
else:
|
||||
name = f"{slugify(str(document))}_{document.id}{document.file_type}"
|
||||
original_name = os.path.join("originals", name)
|
||||
|
||||
@@ -69,3 +69,9 @@ class TestExportImport(DirectoriesMixin, TestCase):
|
||||
call_command('document_exporter', target)
|
||||
Document.objects.create(checksum="AAAAAAAAAAAAAAAAA", title="wow", filename="0000004.pdf", id=3, mime_type="application/pdf")
|
||||
self.assertRaises(FileNotFoundError, call_command, 'document_exporter', target)
|
||||
|
||||
@override_settings(
|
||||
PAPERLESS_FILENAME_FORMAT="{correspondent}/{year}/{title}"
|
||||
)
|
||||
def test_export_with_filename_format(self):
|
||||
self.test_exporter()
|
||||
@@ -1,5 +1,3 @@
|
||||
from datetime import datetime
|
||||
|
||||
from django.test import TestCase
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
Reference in new issue
Block a user