Browse files

Adds test to NonAbstract model inheritance

  • Loading branch information...
1 parent 2d12b9d commit 9a66d5c654f91c49a074add909e41c8761da6823 Bernardo Fontes committed with Mar 30, 2013
Showing with 10 additions and 1 deletion.
  1. +3 −0 test/generic/models.py
  2. +7 −1 test/generic/tests/test_mommy.py
View
3 test/generic/models.py
@@ -159,3 +159,6 @@ class SchoolEnrollment(models.Model):
start_date = models.DateField(auto_now_add=True)
school = models.ForeignKey(School)
student = models.ForeignKey(Person)
+
+class NonAbstractPerson(Person):
+ pass
View
8 test/generic/tests/test_mommy.py
@@ -11,7 +11,7 @@
from test.generic.models import UnsupportedModel, DummyGenericRelationModel
from test.generic.models import DummyNullFieldsModel, DummyBlankFieldsModel
from test.generic.models import DummyDefaultFieldsModel
-from test.generic.models import DummyGenericForeignKeyModel
+from test.generic.models import DummyGenericForeignKeyModel, NonAbstractPerson
class ModelFinderTest(TestCase):
@@ -80,6 +80,12 @@ def test_prepare_one_should_not_persist_one_object(self):
self.assertEqual(Person.objects.all().count(), 0)
self.assertEqual(person.id, None)
+ def test_non_abstract_model_creation(self):
+ person = mommy.make(NonAbstractPerson, name='bob', happy=False)
+ self.assertIsInstance(person, NonAbstractPerson)
+ self.assertEqual('bob', person.name)
+ self.assertFalse(person.happy)
+
class MommyRepeatedCreatesSimpleModel(TestCase):

0 comments on commit 9a66d5c

Please sign in to comment.