Finish the document parsing app.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -2,40 +2,38 @@ from __future__ import unicode_literals
|
||||
|
||||
from actstream.models import Action
|
||||
|
||||
from documents.tests.literals import TEST_DOCUMENT_FILENAME
|
||||
from documents.tests.test_models import GenericDocumentTestCase
|
||||
|
||||
from ..events import (
|
||||
event_ocr_document_version_submit, event_ocr_document_version_finish
|
||||
event_parsing_document_version_submit,
|
||||
event_parsing_document_version_finish
|
||||
)
|
||||
|
||||
|
||||
class OCREventsTestCase(GenericDocumentTestCase):
|
||||
class DocumentParsingEventsTestCase(GenericDocumentTestCase):
|
||||
# Ensure we use a PDF file
|
||||
test_document_filename = TEST_DOCUMENT_FILENAME
|
||||
|
||||
def test_document_version_submit_event(self):
|
||||
Action.objects.all().delete()
|
||||
self.document.submit_for_ocr()
|
||||
|
||||
self.assertEqual(
|
||||
Action.objects.first().target, self.document.latest_version
|
||||
)
|
||||
self.assertEqual(
|
||||
Action.objects.first().verb,
|
||||
event_ocr_document_version_submit.name
|
||||
)
|
||||
|
||||
def test_document_version_finish_event(self):
|
||||
Action.objects.all().delete()
|
||||
self.document.submit_for_ocr()
|
||||
from ..models import DocumentVersionOCRError, DocumentPageContent
|
||||
#print DocumentVersionOCRError.objects.all()
|
||||
print DocumentPageContent.objects.all()
|
||||
|
||||
for a in Action.objects.all():
|
||||
print a
|
||||
self.document.submit_for_parsing()
|
||||
|
||||
self.assertEqual(
|
||||
Action.objects.last().target, self.document.latest_version
|
||||
)
|
||||
self.assertEqual(
|
||||
Action.objects.last().verb,
|
||||
event_ocr_document_version_finish.name
|
||||
event_parsing_document_version_submit.name
|
||||
)
|
||||
|
||||
def test_document_version_finish_event(self):
|
||||
Action.objects.all().delete()
|
||||
self.document.submit_for_parsing()
|
||||
self.assertEqual(
|
||||
Action.objects.first().target, self.document.latest_version
|
||||
)
|
||||
self.assertEqual(
|
||||
Action.objects.first().verb,
|
||||
event_parsing_document_version_finish.name
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user