From 7308c858b318a7f9bbdad8e0ee36ac985b3a8561 Mon Sep 17 00:00:00 2001 From: tvh Date: Thu, 2 Nov 2023 18:55:05 +0100 Subject: [PATCH] added mimetype/file extension to tesseract parser test --- src/documents/tests/test_api.py | 20 ++++++++++++++++++++ src/documents/tests/test_parsers.py | 1 + src/setup.cfg | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py index 8aff680a3..7e239720a 100644 --- a/src/documents/tests/test_api.py +++ b/src/documents/tests/test_api.py @@ -1635,6 +1635,26 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase): self.assertIsNone(overrides.document_type_id) self.assertIsNone(overrides.tag_ids) + def test_upload_zipfile(self): + import logging + + LOGGER = logging.getLogger(__name__) + + self.consume_file_mock.return_value = celery.result.AsyncResult( + id=str(uuid.uuid4()), + ) + + with open( + os.path.join(os.path.dirname(__file__), "samples", "simple.zip"), + "rb", + ) as f: + response = self.client.post( + "/api/documents/post_document/", + {"document": f}, + ) + LOGGER.info(response.content) + self.assertEqual(response.status_code, status.HTTP_200_OK) + def test_upload_empty_metadata(self): self.consume_file_mock.return_value = celery.result.AsyncResult( id=str(uuid.uuid4()), diff --git a/src/documents/tests/test_parsers.py b/src/documents/tests/test_parsers.py index fee7234e8..14cf26b24 100644 --- a/src/documents/tests/test_parsers.py +++ b/src/documents/tests/test_parsers.py @@ -138,6 +138,7 @@ class TestParserAvailability(TestCase): - The Tesseract based parser is return """ supported_mimes_and_exts = [ + ("application/zip", ".zip"), ("application/pdf", ".pdf"), ("image/png", ".png"), ("image/jpeg", ".jpg"), diff --git a/src/setup.cfg b/src/setup.cfg index c4b197e79..4c10d85d2 100644 --- a/src/setup.cfg +++ b/src/setup.cfg @@ -7,7 +7,7 @@ max-line-length = 88 [tool:pytest] DJANGO_SETTINGS_MODULE=paperless.settings -addopts = --pythonwarnings=all --cov --cov-report=html --cov-report=xml --numprocesses auto --maxprocesses=16 --quiet --durations=50 +#addopts = --pythonwarnings=all --cov --cov-report=html --cov-report=xml --numprocesses auto --maxprocesses=16 --durations=50 --log-cli-level=INFO env = PAPERLESS_DISABLE_DBHANDLER=true