Refactoring ModelTestCase
This commit is contained in:
parent
09eb8794b8
commit
c78ff60231
@ -5,7 +5,7 @@ from django.test import TestCase
|
|||||||
|
|
||||||
# Creating a test user
|
# Creating a test user
|
||||||
|
|
||||||
class ModelTestCase:
|
class ModelTestCaseMixin:
|
||||||
'''
|
'''
|
||||||
Base class for ModelTests
|
Base class for ModelTests
|
||||||
'''
|
'''
|
||||||
@ -151,7 +151,7 @@ class ModelTestCase:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SubmittableTestCase(ModelTestCase):
|
class SubmittableTestCase(ModelTestCaseMixin):
|
||||||
related_name = None
|
related_name = None
|
||||||
nullable = False
|
nullable = False
|
||||||
|
|
||||||
|
@ -5,12 +5,12 @@ from django.db import models
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from lostplaces_app.models import Place, Taggable, MapablePoint
|
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
|
from taggit.managers import TaggableManager
|
||||||
|
|
||||||
|
|
||||||
class TaggableTestCase(ModelTestCase, TestCase):
|
class TaggableTestCase(ModelTestCaseMixin, TestCase):
|
||||||
|
|
||||||
model = Taggable
|
model = Taggable
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ class TaggableTestCase(ModelTestCase, TestCase):
|
|||||||
self.assertField('tags', TaggableManager)
|
self.assertField('tags', TaggableManager)
|
||||||
|
|
||||||
|
|
||||||
class MapablePointTestCase(ModelTestCase, TestCase):
|
class MapablePointTestCase(ModelTestCaseMixin, TestCase):
|
||||||
|
|
||||||
model = MapablePoint
|
model = MapablePoint
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ from django.db import models
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from lostplaces_app.models import Voucher
|
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
|
model = Voucher
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user