Refactoring ModelTestCase

This commit is contained in:
reverend 2020-09-13 13:31:41 +02:00
parent 09eb8794b8
commit c78ff60231
3 changed files with 7 additions and 7 deletions

View File

@ -5,7 +5,7 @@ from django.test import TestCase
# Creating a test user
class ModelTestCase:
class ModelTestCaseMixin:
'''
Base class for ModelTests
'''
@ -151,7 +151,7 @@ class ModelTestCase:
)
class SubmittableTestCase(ModelTestCase):
class SubmittableTestCase(ModelTestCaseMixin):
related_name = None
nullable = False

View File

@ -5,12 +5,12 @@ from django.db import models
from django.contrib.auth.models import User
from lostplaces_app.models import Place, Taggable, MapablePoint
from lostplaces_app.tests.models import ModelTestCase
from lostplaces_app.tests.models import ModelTestCaseMixin
from taggit.managers import TaggableManager
class TaggableTestCase(ModelTestCase, TestCase):
class TaggableTestCase(ModelTestCaseMixin, TestCase):
model = Taggable
@ -18,7 +18,7 @@ class TaggableTestCase(ModelTestCase, TestCase):
self.assertField('tags', TaggableManager)
class MapablePointTestCase(ModelTestCase, TestCase):
class MapablePointTestCase(ModelTestCaseMixin, TestCase):
model = MapablePoint

View File

@ -5,10 +5,10 @@ from django.db import models
from django.utils import timezone
from lostplaces_app.models import Voucher
from lostplaces_app.tests.models import ModelTestCase
from lostplaces_app.tests.models import ModelTestCaseMixin
class VoucheTestCase(ModelTestCase, TestCase):
class VoucheTestCase(ModelTestCaseMixin, TestCase):
model = Voucher
@classmethod