'Ensures simple dynamic documents are saved correctly'

def test_simple_dynamic_document(self):

    p = self.Person()
    p.name = 'James'
    p.age = 34
    self.assertEqual(p.to_mongo(), {'_cls': 'Person', 'name': 'James', 'age': 34})
    self.assertEqual(p.to_mongo().keys(), ['_cls', 'name', 'age'])
    p.save()
    self.assertEqual(p.to_mongo().keys(), ['_id', '_cls', 'name', 'age'])
    self.assertEqual(self.Person.objects.first().age, 34)
    self.assertFalse(hasattr(self.Person, 'age'))
