'Ensure that a document cannot be referenced if there are
still documents referring to it.'

def test_reverse_delete_rule_deny(self):

    class BlogPost(Document, ):
        content = StringField()
        author = ReferenceField(self.Person, reverse_delete_rule=DENY)
    self.Person.drop_collection()
    BlogPost.drop_collection()
    author = self.Person(name='Test    User')
    author.save()
    post = BlogPost(content='Watched    some    TV')
    post.author = author
    post.save()
    self.assertRaises(OperationError, author.delete)
    self.assertEqual(BlogPost.objects.count(), 1)
    self.assertEqual(self.Person.objects.count(), 1)
    author = self.Person(name='Another    User')
    author.save()
    self.assertEqual(self.Person.objects.count(), 2)
    author.delete()
    self.assertEqual(self.Person.objects.count(), 1)
