Allow test document to be overrided by test subclasses
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,33 +1,42 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from datetime import timedelta
|
||||
import os
|
||||
import time
|
||||
|
||||
from common.tests import BaseTestCase
|
||||
from django.conf import settings
|
||||
from django.test import override_settings
|
||||
|
||||
from common.tests import BaseTestCase
|
||||
|
||||
from ..literals import STUB_EXPIRATION_INTERVAL
|
||||
from ..models import DeletedDocument, Document, DocumentType
|
||||
|
||||
from .literals import (
|
||||
TEST_DOCUMENT_TYPE_LABEL, TEST_DOCUMENT_PATH, TEST_MULTI_PAGE_TIFF_PATH,
|
||||
TEST_PDF_INDIRECT_ROTATE_PATH, TEST_OFFICE_DOCUMENT_PATH,
|
||||
TEST_SMALL_DOCUMENT_PATH
|
||||
TEST_SMALL_DOCUMENT_FILENAME, TEST_SMALL_DOCUMENT_PATH
|
||||
)
|
||||
|
||||
|
||||
@override_settings(OCR_AUTO_OCR=False)
|
||||
class GenericDocumentTestCase(BaseTestCase):
|
||||
test_document_filename = TEST_SMALL_DOCUMENT_FILENAME
|
||||
|
||||
def setUp(self):
|
||||
super(GenericDocumentTestCase, self).setUp()
|
||||
self.test_document_path = os.path.join(
|
||||
settings.BASE_DIR, 'apps', 'documents', 'tests', 'contrib',
|
||||
'sample_documents', self.test_document_filename
|
||||
)
|
||||
|
||||
self.document_type = DocumentType.objects.create(
|
||||
label=TEST_DOCUMENT_TYPE_LABEL
|
||||
)
|
||||
|
||||
with open(TEST_SMALL_DOCUMENT_PATH) as file_object:
|
||||
with open(self.test_document_path) as file_object:
|
||||
self.document = self.document_type.new_document(
|
||||
file_object=file_object
|
||||
file_object=file_object, label=self.test_document_filename
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import override_settings
|
||||
from django.utils.encoding import force_text
|
||||
@@ -36,15 +39,22 @@ from .literals import (
|
||||
|
||||
@override_settings(OCR_AUTO_OCR=False)
|
||||
class GenericDocumentViewTestCase(GenericViewTestCase):
|
||||
test_document_filename = TEST_SMALL_DOCUMENT_FILENAME
|
||||
|
||||
def setUp(self):
|
||||
super(GenericDocumentViewTestCase, self).setUp()
|
||||
self.document_type = DocumentType.objects.create(
|
||||
label=TEST_DOCUMENT_TYPE_LABEL
|
||||
)
|
||||
|
||||
with open(TEST_SMALL_DOCUMENT_PATH) as file_object:
|
||||
self.test_document_path = os.path.join(
|
||||
settings.BASE_DIR, 'apps', 'documents', 'tests', 'contrib',
|
||||
'sample_documents', self.test_document_filename
|
||||
)
|
||||
|
||||
with open(self.test_document_path) as file_object:
|
||||
self.document = self.document_type.new_document(
|
||||
file_object=file_object, label=TEST_SMALL_DOCUMENT_FILENAME
|
||||
file_object=file_object, label=self.test_document_filename
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
|
||||
Reference in New Issue
Block a user