diff --git a/mayan/apps/common/tests/base.py b/mayan/apps/common/tests/base.py index 2638cd5452..cf67bf5ec7 100644 --- a/mayan/apps/common/tests/base.py +++ b/mayan/apps/common/tests/base.py @@ -19,11 +19,12 @@ from user_management.tests import ( from .literals import TEST_VIEW_NAME, TEST_VIEW_URL from .mixins import ( - ContentTypeCheckMixin, OpenFileCheckMixin, TempfileCheckMixin, UserMixin + ContentTypeCheckMixin, DatabaseConversionMixin, OpenFileCheckMixin, + TempfileCheckMixin, UserMixin ) -class BaseTestCase(UserMixin, ContentTypeCheckMixin, OpenFileCheckMixin, TempfileCheckMixin, TestCase): +class BaseTestCase(DatabaseConversionMixin, UserMixin, ContentTypeCheckMixin, OpenFileCheckMixin, TempfileCheckMixin, TestCase): """ This is the most basic test case class any test in the project should use. """ diff --git a/mayan/apps/common/tests/mixins.py b/mayan/apps/common/tests/mixins.py index c47d9848fb..a40433a5e8 100644 --- a/mayan/apps/common/tests/mixins.py +++ b/mayan/apps/common/tests/mixins.py @@ -6,6 +6,7 @@ import os from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.core import management if getattr(settings, 'COMMON_TEST_FILE_HANDLES', False): import psutil @@ -45,6 +46,13 @@ class ContentTypeCheckMixin(object): self.client = CustomClient() +class DatabaseConversionMixin(object): + def _test_database_conversion(self, *app_labels): + management.call_command( + 'convertdb', *app_labels + ) + + class OpenFileCheckMixin(object): def _get_descriptor_count(self): process = psutil.Process()