Extract test views and user code into their own separate test case mixins. Append TestCase to test case mixins with base test code to differentiate them from test mixins with reusable view calls. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from __future__ import absolute_import, unicode_literals
|
|
|
|
from django.test import TestCase
|
|
from django.urls import reverse
|
|
from django_downloadview import assert_download_response
|
|
|
|
from mayan.apps.acls.tests.mixins import ACLTestCaseMixin
|
|
from mayan.apps.permissions.classes import Permission
|
|
from mayan.apps.smart_settings.classes import Namespace
|
|
|
|
from .mixins import (
|
|
ClientMethodsTestCaseMixin, ContentTypeCheckMixin, DatabaseConversionMixin,
|
|
OpenFileCheckTestCaseMixin, TempfileCheckTestCaseMixin,
|
|
TestViewTestCaseMixin
|
|
)
|
|
|
|
|
|
class BaseTestCase(DatabaseConversionMixin, ACLTestCaseMixin, ContentTypeCheckMixin, OpenFileCheckTestCaseMixin, TempfileCheckTestCaseMixin, TestCase):
|
|
"""
|
|
This is the most basic test case class any test in the project should use.
|
|
"""
|
|
assert_download_response = assert_download_response
|
|
|
|
def setUp(self):
|
|
super(BaseTestCase, self).setUp()
|
|
Namespace.invalidate_cache_all()
|
|
Permission.invalidate_cache()
|
|
|
|
|
|
class GenericViewTestCase(ClientMethodsTestCaseMixin, TestViewTestCaseMixin, BaseTestCase):
|
|
"""
|
|
A generic view test case built on top of the base test case providing
|
|
single user test view to test object resolution and shorthand HTTP
|
|
method functions.
|
|
"""
|