move contrib tests to separate file

fix_request_path_info
Diederik van der Boor 2017-08-01 11:37:53 +02:00
parent 88d59d985b
commit b772c06358
2 changed files with 26 additions and 18 deletions

View File

@ -0,0 +1,26 @@
from polymorphic.contrib.guardian import get_polymorphic_base_content_type
from polymorphic.tests import * # all models
class ContribTests(TestCase):
"""
The test suite
"""
def test_contrib_guardian(self):
# Regular Django inheritance should return the child model content type.
obj = PlainC()
ctype = get_polymorphic_base_content_type(obj)
self.assertEqual(ctype.name, 'plain c')
ctype = get_polymorphic_base_content_type(PlainC)
self.assertEqual(ctype.name, 'plain c')
# Polymorphic inheritance should return the parent model content type.
obj = Model2D()
ctype = get_polymorphic_base_content_type(obj)
self.assertEqual(ctype.name, 'model2a')
ctype = get_polymorphic_base_content_type(Model2D)
self.assertEqual(ctype.name, 'model2a')

View File

@ -4,7 +4,6 @@ import django
from django.db.models import Case, Count, Q, When
from django.test import TestCase
from django.utils import six
from polymorphic.contrib.guardian import get_polymorphic_base_content_type
from polymorphic.tests import * # all models
@ -766,23 +765,6 @@ class PolymorphicTests(TestCase):
result = Model2B.objects.annotate(val=Concat('field1', 'field2'))
self.assertEqual(list(result), [])
def test_contrib_guardian(self):
# Regular Django inheritance should return the child model content type.
obj = PlainC()
ctype = get_polymorphic_base_content_type(obj)
self.assertEqual(ctype.name, 'plain c')
ctype = get_polymorphic_base_content_type(PlainC)
self.assertEqual(ctype.name, 'plain c')
# Polymorphic inheritance should return the parent model content type.
obj = Model2D()
ctype = get_polymorphic_base_content_type(obj)
self.assertEqual(ctype.name, 'model2a')
ctype = get_polymorphic_base_content_type(Model2D)
self.assertEqual(ctype.name, 'model2a')
def qrepr(data):
"""