added mimetype/file extension to tesseract parser test

This commit is contained in:
tvh 2023-11-02 18:55:05 +01:00
parent 5e82adcf1d
commit 7308c858b3
3 changed files with 22 additions and 1 deletions

View File

@ -1635,6 +1635,26 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
self.assertIsNone(overrides.document_type_id) self.assertIsNone(overrides.document_type_id)
self.assertIsNone(overrides.tag_ids) 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): def test_upload_empty_metadata(self):
self.consume_file_mock.return_value = celery.result.AsyncResult( self.consume_file_mock.return_value = celery.result.AsyncResult(
id=str(uuid.uuid4()), id=str(uuid.uuid4()),

View File

@ -138,6 +138,7 @@ class TestParserAvailability(TestCase):
- The Tesseract based parser is return - The Tesseract based parser is return
""" """
supported_mimes_and_exts = [ supported_mimes_and_exts = [
("application/zip", ".zip"),
("application/pdf", ".pdf"), ("application/pdf", ".pdf"),
("image/png", ".png"), ("image/png", ".png"),
("image/jpeg", ".jpg"), ("image/jpeg", ".jpg"),

View File

@ -7,7 +7,7 @@ max-line-length = 88
[tool:pytest] [tool:pytest]
DJANGO_SETTINGS_MODULE=paperless.settings 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 = env =
PAPERLESS_DISABLE_DBHANDLER=true PAPERLESS_DISABLE_DBHANDLER=true