<s> from mocktest import * <EOL> from pyqcy import * <EOL> from sqlalchemy import * <EOL> import neat . db <EOL> import neat . db_utils as db_utils <EOL> import logging <EOL> logging . disable ( logging . CRITICAL ) <EOL> class DbUtils ( TestCase ) : <EOL> @ qc ( <NUM_LIT:1> ) <EOL> def init_db ( ) : <EOL> db = db_utils . init_db ( '<STR_LIT>' ) <EOL> assert type ( db ) is neat . db . Database <EOL> assert isinstance ( db . hosts , Table ) <EOL> assert isinstance ( db . vms , Table ) <EOL> assert isinstance ( db . vm_resource_usage , Table ) <EOL> assert isinstance ( db . host_states , Table ) <EOL> assert db . hosts . c . keys ( ) == [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> assert db . host_resource_usage . c . keys ( ) == [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> assert list ( db . host_resource_usage . foreign_keys ) [ <NUM_LIT:0> ] . target_fullname == '<STR_LIT>' <EOL> assert db . vms . c . keys ( ) == [ '<STR_LIT:id>' , '<STR_LIT>' ] <EOL> assert db . vm_resource_usage . c . keys ( ) == [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> assert list ( db . vm_resource_usage . foreign_keys ) [ <NUM_LIT:0> ] . target_fullname == '<STR_LIT>' <EOL> assert db . vm_migrations . c . keys ( ) == [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> keys = set ( [ list ( db . vm_migrations . foreign_keys ) [ <NUM_LIT:0> ] . target_fullname , <EOL> list ( db . vm_migrations . foreign_keys ) [ <NUM_LIT:1> ] . target_fullname ] ) <EOL> assert keys == set ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> assert db . host_states . c . keys ( ) == [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:state>' ] <EOL> assert list ( db . host_states . foreign_keys ) [ <NUM_LIT:0> ] . target_fullname == '<STR_LIT>' <EOL> assert db . host_overload . c . keys ( ) == [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> assert list ( db . host_overload . foreign_keys ) [ <NUM_LIT:0> ] . target_fullname == '<STR_LIT>' </s>
