mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-08 02:34:08 -04:00
Test fixes / coverage
This commit is contained in:
parent
14767ac46a
commit
5c0add9615
@ -18,7 +18,7 @@ class TestChecks(TestCase):
|
|||||||
self.assertEqual(len(msgs), 1)
|
self.assertEqual(len(msgs), 1)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
msgs[0].msg.startswith(
|
msgs[0].msg.startswith(
|
||||||
"Azure AI Vision remote parser requires endpoint to be configured.",
|
"Azure AI remote parser requires endpoint to be configured.",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ from django.test import override_settings
|
|||||||
from documents.tests.utils import DirectoriesMixin
|
from documents.tests.utils import DirectoriesMixin
|
||||||
from documents.tests.utils import FileSystemAssertsMixin
|
from documents.tests.utils import FileSystemAssertsMixin
|
||||||
from paperless_remote.parsers import RemoteDocumentParser
|
from paperless_remote.parsers import RemoteDocumentParser
|
||||||
|
from paperless_remote.signals import get_parser
|
||||||
|
|
||||||
|
|
||||||
class TestParser(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
class TestParser(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
||||||
@ -56,7 +57,7 @@ class TestParser(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
|||||||
REMOTE_OCR_API_KEY="somekey",
|
REMOTE_OCR_API_KEY="somekey",
|
||||||
REMOTE_OCR_ENDPOINT="https://endpoint.cognitiveservices.azure.com",
|
REMOTE_OCR_ENDPOINT="https://endpoint.cognitiveservices.azure.com",
|
||||||
):
|
):
|
||||||
parser = RemoteDocumentParser(uuid.uuid4())
|
parser = get_parser(uuid.uuid4())
|
||||||
parser.parse(
|
parser.parse(
|
||||||
self.SAMPLE_FILES / "simple-digital.pdf",
|
self.SAMPLE_FILES / "simple-digital.pdf",
|
||||||
"application/pdf",
|
"application/pdf",
|
||||||
@ -86,7 +87,7 @@ class TestParser(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
|||||||
self.assertEqual(parser.supported_mime_types(), expected_types)
|
self.assertEqual(parser.supported_mime_types(), expected_types)
|
||||||
|
|
||||||
def test_supported_mime_types_invalid_config(self):
|
def test_supported_mime_types_invalid_config(self):
|
||||||
parser = RemoteDocumentParser(uuid.uuid4())
|
parser = get_parser(uuid.uuid4())
|
||||||
# with override_settings(
|
# with override_settings(
|
||||||
# REMOTE_OCR_ENGINE=None,
|
# REMOTE_OCR_ENGINE=None,
|
||||||
# REMOTE_OCR_API_KEY=None,
|
# REMOTE_OCR_API_KEY=None,
|
||||||
@ -100,6 +101,6 @@ class TestParser(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
|||||||
REMOTE_OCR_ENDPOINT=None,
|
REMOTE_OCR_ENDPOINT=None,
|
||||||
)
|
)
|
||||||
def test_parse_with_invalid_config(self):
|
def test_parse_with_invalid_config(self):
|
||||||
parser = RemoteDocumentParser(uuid.uuid4())
|
parser = get_parser(uuid.uuid4())
|
||||||
parser.parse(self.SAMPLE_FILES / "simple-digital.pdf", "application/pdf")
|
parser.parse(self.SAMPLE_FILES / "simple-digital.pdf", "application/pdf")
|
||||||
self.assertEqual(parser.text, "")
|
self.assertEqual(parser.text, "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user