Skip to content
Browse files

Other failing tests. Part 2.

  • Loading branch information...
1 parent 79d85e8 commit 883e6bd2974859cbc7879e868e22249deb25ae54 @hackoder hackoder committed
Showing with 10 additions and 0 deletions.
  1. +1 −0 test/generic/models.py
  2. +9 −0 test/generic/tests/test_mommy.py
View
1 test/generic/models.py
@@ -64,6 +64,7 @@ class Person(models.Model):
class Dog(models.Model):
owner = models.ForeignKey('Person')
breed = models.CharField(max_length=50)
+ created = models.DateTimeField(auto_now_add=True)
class GuardDog(Dog):
pass
View
9 test/generic/tests/test_mommy.py
@@ -168,6 +168,15 @@ def test_foreign_key_on_parent_should_create_one_object(self):
dog = mommy.make(GuardDog)
self.assertEqual(Person.objects.count(), person_count+1)
+ def test_auto_now_add_on_parent_should_work(self):
+ '''
+ Foreign key on parent gets created twice. Once for
+ parent oject and another time for child object
+ '''
+ person_count = Person.objects.count()
+ dog = mommy.make(GuardDog)
+ self.assertNotEqual(dog.created, None)
+
def test_attrs_on_related_model_through_parent(self):
'''
Foreign key on parent gets created twice. Once for

0 comments on commit 883e6bd

Please sign in to comment.
Something went wrong with that request. Please try again.