Files
mayan-edms/mayan/apps/ocr/tests/test_indexing.py
Roberto Rosario 8e69178e07 Project: Switch to full app paths
Instead of inserting the path of the apps into the Python app,
the apps are now referenced by their full import path.

This app name claves with external or native Python libraries.
Example: Mayan statistics app vs. Python new statistics library.

Every app reference is now prepended with 'mayan.apps'.

Existing config.yml files need to be updated manually.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2018-12-05 02:04:20 -04:00

38 lines
1.1 KiB
Python

from __future__ import unicode_literals
from django.test import override_settings
from mayan.apps.common.tests import BaseTestCase
from mayan.apps.documents.tests import DocumentTestMixin
from mayan.apps.document_indexing.models import Index, IndexInstanceNode
from mayan.apps.document_indexing.tests.literals import TEST_INDEX_LABEL
from .literals import (
TEST_OCR_INDEX_NODE_TEMPLATE, TEST_OCR_INDEX_NODE_TEMPLATE_LEVEL
)
@override_settings(OCR_AUTO_OCR=False)
class OCRIndexingTestCase(DocumentTestMixin, BaseTestCase):
auto_upload_document = False
def test_ocr_indexing(self):
index = Index.objects.create(label=TEST_INDEX_LABEL)
index.document_types.add(self.document_type)
root = index.template_root
index.node_templates.create(
parent=root, expression=TEST_OCR_INDEX_NODE_TEMPLATE,
link_documents=True
)
self.document = self.upload_document()
self.document.submit_for_ocr()
self.assertTrue(
self.document in IndexInstanceNode.objects.get(
value=TEST_OCR_INDEX_NODE_TEMPLATE_LEVEL
).documents.all()
)