'Ensure that Bi-Directional relationships work with
reverse_delete_rule'

def test_two_way_reverse_delete_rule(self):

    class Bar(Document, ):
        content = StringField()
        foo = ReferenceField('Foo')
    class Foo(Document, ):
        content = StringField()
        bar = ReferenceField(Bar)
    Bar.register_delete_rule(Foo, 'bar', NULLIFY)
    Foo.register_delete_rule(Bar, 'foo', NULLIFY)
    Bar.drop_collection()
    Foo.drop_collection()
    b = Bar(content='Hello')
    b.save()
    f = Foo(content='world', bar=b)
    f.save()
    b.foo = f
    b.save()
    f.delete()
    self.assertEqual(Bar.objects.count(), 1)
    self.assertEqual(Bar.objects.get().foo, None)
