Improve tests, update migrations

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-09-05 22:18:59 -04:00
parent a13f033104
commit 9448b148e9
12 changed files with 88 additions and 94 deletions
@@ -0,0 +1,31 @@
from __future__ import unicode_literals
from mayan.apps.documents.tests.base import GenericDocumentTestCase
from mayan.apps.storage.utils import fs_cleanup, mkstemp
from ..control_codes import ControlCodeAttributeEdit
class ControlCodeAttributeEditTestCase(GenericDocumentTestCase):
auto_upload_document = False
def setUp(self):
super(ControlCodeAttributeEditTestCase, self).setUp()
self.test_document_path = mkstemp()[1]
def tearDown(self):
fs_cleanup(filename=self.test_document_path)
super(ControlCodeAttributeEditTestCase, self).tearDown()
def test_control_code(self):
TEST_ATTRIBUTE_VALUE = 'test value'
with open(self.test_document_path, mode='wb') as file_object:
control_code = ControlCodeAttributeEdit(
name='label', value=TEST_ATTRIBUTE_VALUE
)
control_code.get_image().save(file_object)
self.upload_document()
self.test_document.refresh_from_db()
self.assertEqual(self.test_document.label, TEST_ATTRIBUTE_VALUE)