#NEWLINE# def test_copy_table_between_databases( self ) : #NEWLINE# #INDENT# 'Test copy of a table from one database to another database.' #NEWLINE# self . dbname1 = dbutil . random_name ( 'test_copy_db' ) #NEWLINE# self . dbname2 = dbutil . random_name ( 'test_copy_db' ) #NEWLINE# self . filename1 = ( self . dbname1 + '.sql' ) #NEWLINE# dbutil . TESTSERVER . create ( self . dbname1 , self . SAVE_DIR , self . SAVE_FILE ) #NEWLINE# dbutil . TESTSERVER . create ( self . dbname2 , self . SAVE_DIR , self . SAVE_FILE ) #NEWLINE# conn1 = dbutil . TESTSERVER . connect ( self . dbname1 , superuser = True ) #NEWLINE# conn2 = dbutil . TESTSERVER . connect ( self . dbname2 , superuser = True ) #NEWLINE# conn1 = dbcompare . ComparisonWrapper ( conn1 ) #NEWLINE# conn2 = dbcompare . ComparisonWrapper ( conn2 ) #NEWLINE# table_name = 'some_dummy_table_name' #NEWLINE# sql = ( ( ( ( 'CREATE TABLE ' + table_name ) + ' AS ' ) + '\n' ) + 'SELECT * FROM tile_type;' ) #NEWLINE# with conn1 . cursor ( ) as cur : #NEWLINE# #INDENT# cur . execute ( sql ) #NEWLINE# #UNINDENT# exists = conn1 . table_exists ( table_name ) #NEWLINE# if ( not exists ) : #NEWLINE# #INDENT# self . fail ( ( ( 'Table ' + table_name ) + ' should exist on Database 1' ) ) #NEWLINE# #UNINDENT# exists = conn2 . table_exists ( table_name ) #NEWLINE# if exists : #NEWLINE# #INDENT# self . fail ( ( ( 'Table ' + table_name ) + ' should not exist in Database 2' ) ) #NEWLINE# #UNINDENT# dbutil . TESTSERVER . copy_table_between_databases ( self . dbname1 , self . dbname2 , table_name ) #NEWLINE# exists = conn2 . table_exists ( table_name ) #NEWLINE# if ( not exists ) : #NEWLINE# #INDENT# self . fail ( ( ( 'Table ' + table_name ) + ' should exist' ) )