Make document type creation optional but default to true in the generic document view test base class.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-04-06 01:13:59 -04:00
parent b0c2d6cd76
commit b77c7bba30

View File

@@ -19,9 +19,15 @@ from .literals import (
@override_settings(OCR_AUTO_OCR=False)
class GenericDocumentTestCase(BaseTestCase):
auto_create_document_type = True
auto_upload_document = True
test_document_filename = TEST_SMALL_DOCUMENT_FILENAME
def create_document_type(self):
self.document_type = DocumentType.objects.create(
label=TEST_DOCUMENT_TYPE_LABEL
)
def upload_document(self):
with open(self.test_document_path) as file_object:
document = self.document_type.new_document(
@@ -36,11 +42,11 @@ class GenericDocumentTestCase(BaseTestCase):
'sample_documents', self.test_document_filename
)
self.document_type = DocumentType.objects.create(
label=TEST_DOCUMENT_TYPE_LABEL
)
if self.auto_upload_document:
self.document = self.upload_document()
if self.auto_create_document_type:
self.create_document_type()
if self.auto_upload_document:
self.document = self.upload_document()
def tearDown(self):
self.document_type.delete()