move contrib tests to separate file
parent
88d59d985b
commit
b772c06358
|
|
@ -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')
|
||||||
|
|
@ -4,7 +4,6 @@ import django
|
||||||
from django.db.models import Case, Count, Q, When
|
from django.db.models import Case, Count, Q, When
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from polymorphic.contrib.guardian import get_polymorphic_base_content_type
|
|
||||||
from polymorphic.tests import * # all models
|
from polymorphic.tests import * # all models
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -766,23 +765,6 @@ class PolymorphicTests(TestCase):
|
||||||
result = Model2B.objects.annotate(val=Concat('field1', 'field2'))
|
result = Model2B.objects.annotate(val=Concat('field1', 'field2'))
|
||||||
self.assertEqual(list(result), [])
|
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):
|
def qrepr(data):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue