From b77c7bba304192b8f06962b4a5f7a35aef8175d3 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 6 Apr 2018 01:13:59 -0400 Subject: [PATCH] Make document type creation optional but default to true in the generic document view test base class. Signed-off-by: Roberto Rosario --- mayan/apps/documents/tests/base.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mayan/apps/documents/tests/base.py b/mayan/apps/documents/tests/base.py index 70a33802af..99c8e1ebb5 100644 --- a/mayan/apps/documents/tests/base.py +++ b/mayan/apps/documents/tests/base.py @@ -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()