'Ensure the pre_delete signal is triggered upon a cascading
deletion setup a blog post with content, an author and editor
delete the author which triggers deletion of blogpost via
cascade blog post\'s pre_delete signal alters an editor attribute.'

def test_reverse_delete_rule_cascade_triggers_pre_delete_signal(self):

    class Editor(self.Person, ):
        review_queue = IntField(default=0)
    class BlogPost(Document, ):
        content = StringField()
        author = ReferenceField(self.Person, reverse_delete_rule=CASCADE)
        editor = ReferenceField(Editor)
        @classmethod
        def pre_delete(cls, sender, document, **kwargs):
            document.editor.update(dec__review_queue=1)
    signals.pre_delete.connect(BlogPost.pre_delete, sender=BlogPost)
    self.Person.drop_collection()
    BlogPost.drop_collection()
    Editor.drop_collection()
    author = self.Person(name='Will    S.').save()
    editor = Editor(name='Max    P.', review_queue=1).save()
    BlogPost(content='wrote    some    books', author=author, editor=editor).save()
    author.delete()
    editor = Editor.objects(name='Max    P.').get()
    self.assertEqual(editor.review_queue, 0)
