Backport test improvements

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-04-20 02:39:57 -04:00
parent bfcad278aa
commit 0267c79b07
108 changed files with 5434 additions and 4685 deletions

View File

@@ -4,24 +4,23 @@ from django.test import override_settings
from mayan.apps.documents.tests import GenericDocumentTestCase, TEST_HYBRID_DOCUMENT
TEST_DOCUMENT_CONTENT = 'Sample text'
from .literals import TEST_DOCUMENT_CONTENT
class DocumentAutoParsingTestCase(GenericDocumentTestCase):
test_document_filename = TEST_HYBRID_DOCUMENT
auto_create_document_type = False
@override_settings(DOCUMENT_PARSING_AUTO_PARSING=False)
def test_disable_auto_parsing(self):
self._create_document_type()
self.document = self.upload_document()
self.test_document = self.upload_document()
with self.assertRaises(StopIteration):
next(self.document.latest_version.content())
next(self.test_document.latest_version.content())
@override_settings(DOCUMENT_PARSING_AUTO_PARSING=True)
def test_enabled_auto_parsing(self):
self._create_document_type()
self.document = self.upload_document()
self.test_document = self.upload_document()
self.assertTrue(
TEST_DOCUMENT_CONTENT in next(self.document.content())
TEST_DOCUMENT_CONTENT in next(self.test_document.content())
)