From 4d5164c5804882978ec607b695c13cfcbaf4b7be Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Mon, 13 Dec 2010 13:24:20 -0800 Subject: [PATCH] Use multiple objects in the test. This is to ensure only the intended subset is deleted and not all objects. --- tests/queryset.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/queryset.py b/tests/queryset.py index 132549de..d6ec46bb 100644 --- a/tests/queryset.py +++ b/tests/queryset.py @@ -744,13 +744,16 @@ class QuerySetTest(unittest.TestCase): me = self.Person(name='Test User') me.save() + someoneelse = self.Person(name='Some-one Else') + someoneelse.save() - post = BlogPost(content='Watching TV', author=me) - post.save() + BlogPost(content='Watching TV', author=me).save() + BlogPost(content='Chilling out', author=me).save() + BlogPost(content='Pro Testing', author=someoneelse).save() + self.assertEqual(3, BlogPost.objects.count()) + self.Person.objects(name='Test User').delete() self.assertEqual(1, BlogPost.objects.count()) - self.Person.objects.delete() - self.assertEqual(0, BlogPost.objects.count()) def test_delete_rule_nullify(self): """Ensure nullification of references to deleted documents.