diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/djapp/models.py | 11 | ||||
-rw-r--r-- | tests/test_django.py | 17 |
2 files changed, 25 insertions, 3 deletions
diff --git a/tests/djapp/models.py b/tests/djapp/models.py index a65b50a..9b21181 100644 --- a/tests/djapp/models.py +++ b/tests/djapp/models.py @@ -55,6 +55,15 @@ class ConcreteSon(AbstractBase): pass +class AbstractSon(AbstractBase): + class Meta: + abstract = True + + +class ConcreteGrandSon(AbstractSon): + pass + + class StandardSon(StandardModel): pass @@ -77,4 +86,4 @@ else: class WithSignals(models.Model): - foo = models.CharField(max_length=20)
\ No newline at end of file + foo = models.CharField(max_length=20) diff --git a/tests/test_django.py b/tests/test_django.py index 29453e6..37bf7a5 100644 --- a/tests/test_django.py +++ b/tests/test_django.py @@ -130,6 +130,14 @@ class ConcreteSonFactory(AbstractBaseFactory): FACTORY_FOR = models.ConcreteSon +class AbstractSonFactory(AbstractBaseFactory): + FACTORY_FOR = models.AbstractSon + + +class ConcreteGrandSonFactory(AbstractBaseFactory): + FACTORY_FOR = models.ConcreteGrandSon + + class WithFileFactory(factory.django.DjangoModelFactory): FACTORY_FOR = models.WithFile @@ -307,8 +315,13 @@ class DjangoNonIntegerPkTestCase(django_test.TestCase): @unittest.skipIf(django is None, "Django not installed.") class DjangoAbstractBaseSequenceTestCase(django_test.TestCase): def test_auto_sequence(self): - with factory.debug(): - obj = ConcreteSonFactory() + """The sequence of the concrete son of an abstract model should be autonomous.""" + obj = ConcreteSonFactory() + self.assertEqual(1, obj.pk) + + def test_auto_sequence(self): + """The sequence of the concrete grandson of an abstract model should be autonomous.""" + obj = ConcreteGrandSonFactory() self.assertEqual(1, obj.pk) |