Refactor the accesors to behave like methods instead of properties. This means all accesors will be prepended with the string "get_" and will include a set of parenthesis. Improve the ModeAttribute class to use the method's short_description. This commit also adds support for a new method .help_text attribute has been added. Move accessors to their own module, named "methods.py". Remove the PropertyHelper class as the accessors no longer need it. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
30 lines
888 B
Python
30 lines
888 B
Python
from __future__ import unicode_literals
|
|
|
|
from django.test import override_settings
|
|
|
|
from mayan.apps.documents.tests import (
|
|
TEST_HYBRID_DOCUMENT, GenericDocumentTestCase
|
|
)
|
|
|
|
from .literals import TEST_DOCUMENT_CONTENT
|
|
|
|
|
|
class DocumentAutoParsingTestCase(GenericDocumentTestCase):
|
|
test_document_filename = TEST_HYBRID_DOCUMENT
|
|
auto_create_document_type = False
|
|
|
|
def test_disable_auto_parsing(self):
|
|
self._create_document_type()
|
|
self.document = self.upload_document()
|
|
|
|
with self.assertRaises(StopIteration):
|
|
next(self.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.assertTrue(
|
|
TEST_DOCUMENT_CONTENT in self.document.get_content()
|
|
)
|