'Ensure we load data correctly from the right db field.'

def test_db_field_load(self):

    class Person(Document, ):
        name = StringField(required=True)
        _rank = StringField(required=False, db_field='rank')
        @property
        def rank(self):
            return (self._rank or 'Private')
    Person.drop_collection()
    Person(name='Jack', _rank='Corporal').save()
    Person(name='Fred').save()
    self.assertEqual(Person.objects.get(name='Jack').rank, 'Corporal')
    self.assertEqual(Person.objects.get(name='Fred').rank, 'Private')
