'Ensure cascading deletion of referring documents from the database.'

def test_delete_with_limit_handles_delete_rules(self):

    class BlogPost(Document, ):
        content = StringField()
        author = ReferenceField(self.Person, reverse_delete_rule=CASCADE)
    BlogPost.drop_collection()
    me = self.Person(name='Test    User')
    me.save()
    someoneelse = self.Person(name='Some-one    Else')
    someoneelse.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()[:1].delete()
    self.assertEqual(1, BlogPost.objects.count())
