'Test db_alias can be overriden.'

def test_db_alias_overrides(self):

    register_connection('testdb-2', 'mongoenginetest2')
    class A(Document, ):
        'Uses    default    db_alias\n                                                '
        name = StringField()
        meta = {'allow_inheritance': True}
    class B(A, ):
        'Uses    testdb-2    db_alias\n                                                '
        meta = {'db_alias': 'testdb-2'}
    A.objects.all()
    self.assertEqual('testdb-2', B._meta.get('db_alias'))
    self.assertEqual('mongoenginetest', A._get_collection().database.name)
    self.assertEqual('mongoenginetest2', B._get_collection().database.name)
