Refactoring ModelTestCase
This commit is contained in:
		@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user