

def test_innodb_tables(self):
    with mock.patch.object(sa_migration, 'get_engine', return_value=self.migrate_engine):
        sa_migration.db_sync()
    total = self.migrate_engine.execute(("SELECT count(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = '%(database)s'" % {
        'database': self.migrate_engine.url.database,
    }))
    self.assertTrue((total.scalar() > 0), 'No tables found. Wrong schema?')
    noninnodb = self.migrate_engine.execute(("SELECT count(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA='%(database)s' AND ENGINE != 'InnoDB' AND TABLE_NAME != 'migrate_version'" % {
        'database': self.migrate_engine.url.database,
    }))
    count = noninnodb.scalar()
    self.assertEqual(count, 0, ('%d non InnoDB tables created' % count))

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/db/test_migrations.py TestNovaMigrationsMySQL.test_innodb_tables/original