Files
mayan-edms/mayan/apps/common/tests/base.py
Roberto Rosario 50d4aa0e22 Allow disabling test's expected_content_type
Setting expected_content_type to None will now disable
the reponse HTTP content type checking. Added
to allow API tests to be a subclass of the test view test
case and support all the mixins without having to declare
them separately.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
2019-03-15 02:56:34 -04:00

35 lines
1.3 KiB
Python

from __future__ import absolute_import, unicode_literals
from django.test import TestCase
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, RandomPrimaryKeyModelMonkeyPatchMixin,
TempfileCheckTestCaseMixin, TestViewTestCaseMixin
)
class BaseTestCase(RandomPrimaryKeyModelMonkeyPatchMixin, DatabaseConversionMixin, ACLTestCaseMixin, 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, ContentTypeCheckMixin, TestViewTestCaseMixin, BaseTestCase):
"""
A generic view test case built on top of the base test case providing
a single, user customizable view to test object resolution and shorthand
HTTP method functions.
"""