Code style cleanups. Switch to a smaller document for tests.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-10-06 00:10:23 -04:00
parent 0f8825454d
commit 025fafabf4
4 changed files with 28 additions and 48 deletions

View File

@@ -1,31 +1,18 @@
from __future__ import unicode_literals
from django.core.files.base import File
from django.test import override_settings
from common.tests import BaseTestCase
from documents.models import DocumentType
from documents.tests import TEST_DOCUMENT_PATH, TEST_DOCUMENT_TYPE_LABEL
from documents.tests import DocumentTestMixin, TEST_HYBRID_DOCUMENT
from ..parsers import PopplerParser
TEST_DOCUMENT_CONTENT = 'Sample text'
@override_settings(OCR_AUTO_OCR=False)
class ParserTestCase(BaseTestCase):
def setUp(self):
super(ParserTestCase, self).setUp()
self.document_type = DocumentType.objects.create(
label=TEST_DOCUMENT_TYPE_LABEL
)
with open(TEST_DOCUMENT_PATH) as file_object:
self.document = self.document_type.new_document(
file_object=File(file_object)
)
def tearDown(self):
self.document_type.delete()
super(ParserTestCase, self).tearDown()
class ParserTestCase(DocumentTestMixin, BaseTestCase):
test_document_filename = TEST_HYBRID_DOCUMENT
def test_poppler_parser(self):
parser = PopplerParser()
@@ -33,5 +20,5 @@ class ParserTestCase(BaseTestCase):
parser.process_document_version(self.document.latest_version)
self.assertTrue(
'Mayan EDMS Documentation' in self.document.pages.first().content.content
TEST_DOCUMENT_CONTENT in self.document.pages.first().content.content
)