Add cache invalidation test case mixins
Add PermissionTestCaseMixin and SmartSettingTestCaseMixin to better organize cache invalidation of both apps for tests. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
- Improve duplicated document list view logic to not show
|
||||
documents with trashed duplicates.
|
||||
- Backport Docker composer makefile targets.
|
||||
- Add PermissionTestCaseMixin and SmartSettingTestCaseMixin to better
|
||||
organize cache invalidation of both apps for tests.
|
||||
|
||||
3.2.8 (2019-10-01)
|
||||
==================
|
||||
|
||||
@@ -5,8 +5,8 @@ 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 mayan.apps.permissions.tests.mixins import PermissionTestCaseMixin
|
||||
from mayan.apps.smart_settings.tests.mixins import SmartSettingsTestCaseMixin
|
||||
from mayan.apps.user_management.tests.mixins import UserTestMixin
|
||||
|
||||
from .mixins import (
|
||||
@@ -21,19 +21,15 @@ from .mixins import (
|
||||
class BaseTestCase(
|
||||
SilenceLoggerTestCaseMixin, ConnectionsCheckTestCaseMixin,
|
||||
RandomPrimaryKeyModelMonkeyPatchMixin, ACLTestCaseMixin,
|
||||
ModelTestCaseMixin, OpenFileCheckTestCaseMixin,
|
||||
TempfileCheckTestCasekMixin, UserTestMixin, TestCase
|
||||
ModelTestCaseMixin, OpenFileCheckTestCaseMixin, PermissionTestCaseMixin,
|
||||
SmartSettingsTestCaseMixin, TempfileCheckTestCasekMixin, UserTestMixin,
|
||||
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, ContentTypeCheckTestCaseMixin,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from ..classes import PermissionNamespace
|
||||
from ..classes import Permission, PermissionNamespace
|
||||
from ..models import Role
|
||||
|
||||
from .literals import (
|
||||
@@ -45,6 +45,12 @@ class PermissionTestMixin(object):
|
||||
)
|
||||
|
||||
|
||||
class PermissionTestCaseMixin(object):
|
||||
def setUp(self):
|
||||
super(PermissionTestCaseMixin, self).setUp()
|
||||
Permission.invalidate_cache()
|
||||
|
||||
|
||||
class RoleAPIViewTestMixin(object):
|
||||
def _request_test_role_create_api_view(self, extra_data=None):
|
||||
data = {
|
||||
|
||||
@@ -5,6 +5,12 @@ from ..classes import Namespace
|
||||
from .literals import TEST_NAMESPACE_LABEL, TEST_NAMESPACE_NAME
|
||||
|
||||
|
||||
class SmartSettingsTestCaseMixin(object):
|
||||
def setUp(self):
|
||||
super(SmartSettingsTestCaseMixin, self).setUp()
|
||||
Namespace.invalidate_cache_all()
|
||||
|
||||
|
||||
class SmartSettingTestMixin(object):
|
||||
def _create_test_settings_namespace(self):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user