Refactor the model accesors

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>
This commit is contained in:
Roberto Rosario
2018-12-15 04:49:40 -04:00
parent 8c63ef4c69
commit 0e86f2ad8a
42 changed files with 434 additions and 282 deletions

View File

@@ -10,7 +10,7 @@ from ..permissions import (
permission_content_view, permission_document_type_parsing_setup,
permission_parse_document
)
from ..utils import get_document_content
from ..utils import get_document_content_iterator
from .literals import TEST_DOCUMENT_CONTENT
@@ -89,7 +89,7 @@ class DocumentContentViewsTestCase(GenericDocumentViewTestCase):
self.assert_download_response(
response=response, content=(
''.join(get_document_content(document=self.document))
''.join(get_document_content_iterator(document=self.document))
),
)
@@ -132,7 +132,7 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase):
response = self._request_document_type_submit_view()
self.assertEqual(response.status_code, 200)
self.assertTrue(
TEST_DOCUMENT_CONTENT not in self.document.content
TEST_DOCUMENT_CONTENT not in self.document.get_content()
)
def test_document_type_submit_view_with_access(self):
@@ -142,5 +142,5 @@ class DocumentTypeViewsTestCase(GenericDocumentViewTestCase):
response = self._request_document_type_submit_view()
self.assertEqual(response.status_code, 302)
self.assertTrue(
TEST_DOCUMENT_CONTENT in self.document.content
TEST_DOCUMENT_CONTENT in self.document.get_content()
)