Add test mixin to test the db conversion (dumping and loading) of a specific app.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user