'Ensure that DBRef items in ListFields are dereferenced.'

def test_list_item_dereference(self):

    class User(Document, ):
        name = StringField()
    class Group(Document, ):
        members = ListField(ReferenceField(User))
    User.drop_collection()
    Group.drop_collection()
    user1 = User(name='user1')
    user1.save()
    user2 = User(name='user2')
    user2.save()
    group = Group(members=[user1, user2])
    group.save()
    group_obj = Group.objects.first()
    self.assertEqual(group_obj.members[0].name, user1.name)
    self.assertEqual(group_obj.members[1].name, user2.name)
