'Ensure that cascade delete rule doesn\'t mix id among
collections.'

def test_reverse_delete_rule_with_shared_id_among_collections(self):

    class User(Document, ):
        id = IntField(primary_key=True)
    class Book(Document, ):
        id = IntField(primary_key=True)
        author = ReferenceField(User, reverse_delete_rule=CASCADE)
    User.drop_collection()
    Book.drop_collection()
    user_1 = User(id=1).save()
    user_2 = User(id=2).save()
    book_1 = Book(id=1, author=user_2).save()
    book_2 = Book(id=2, author=user_1).save()
    user_2.delete()
    self.assertEqual(Book.objects.count(), 1)
    self.assertEqual(Book.objects.get(), book_2)
    user_3 = User(id=3).save()
    book_3 = Book(id=3, author=user_3).save()
    user_3.delete()
    self.assertEqual(Book.objects.count(), 1)
    self.assertEqual(Book.objects.get(), book_2)
