Files
mayan-edms/mayan/apps/documents/tests/base.py
Michael Price 0a480066df Reorganize common's base test class.
Signed-off-by: Michael Price <loneviking72@gmail.com>
2018-04-01 20:20:37 -04:00

36 lines
1021 B
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import override_settings
from common.tests import GenericViewTestCase
from ..models import DocumentType
from .literals import (
TEST_DOCUMENT_TYPE_LABEL, TEST_SMALL_DOCUMENT_FILENAME,
TEST_SMALL_DOCUMENT_PATH,
)
@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.document = self.document_type.new_document(
file_object=file_object, label=self.test_document_filename
)
def tearDown(self):
if self.document_type.pk:
self.document_type.delete()
super(GenericDocumentViewTestCase, self).tearDown()