Calculate the path of the test document before it is uploaded.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -25,19 +25,23 @@ class DocumentTestMixin(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def upload_document(self):
|
def upload_document(self):
|
||||||
|
self._calculate_test_document_path()
|
||||||
|
|
||||||
with open(self.test_document_path, 'rb') as file_object:
|
with open(self.test_document_path, 'rb') as file_object:
|
||||||
document = self.document_type.new_document(
|
document = self.document_type.new_document(
|
||||||
file_object=file_object, label=self.test_document_filename
|
file_object=file_object, label=self.test_document_filename
|
||||||
)
|
)
|
||||||
return document
|
return document
|
||||||
|
|
||||||
def setUp(self):
|
def _calculate_test_document_path(self):
|
||||||
super(DocumentTestMixin, self).setUp()
|
|
||||||
self.test_document_path = os.path.join(
|
self.test_document_path = os.path.join(
|
||||||
settings.BASE_DIR, 'apps', 'documents', 'tests', 'contrib',
|
settings.BASE_DIR, 'apps', 'documents', 'tests', 'contrib',
|
||||||
'sample_documents', self.test_document_filename
|
'sample_documents', self.test_document_filename
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(DocumentTestMixin, self).setUp()
|
||||||
|
|
||||||
if self.auto_create_document_type:
|
if self.auto_create_document_type:
|
||||||
self._create_document_type()
|
self._create_document_type()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user