def create_non_exist_tables(self, table_diff): """ create tables that do not exist from the table difference between the current database and the configuration """ if len(table_diff) > 0: for table in table_diff: Table_Init.create_table(table, self.global_config) self.log.info('Updated database schema, table names now match configuration.') else: self.log.info('Database Schema and Configuration table names already match.')
def test_create_table(self,gci_get_db_dir): database.create_default_database(self.gci) Table_Init.create_table('TestTable1',self.gci) connection = sqlite3.connect(self.gci.get_db_dir() + '/honeyDB.sqlite') cursor = connection.cursor() table_list = [] for table_tuple in cursor.execute("SELECT name FROM sqlite_master WHERE type='table';").fetchall(): table_list.append(table_tuple[0]) self.assertIn('TestTable1', table_list) connection.close()