示例#1
0
 def testAllColumns(self, mock_query):
     db_result = ResultSet()
     db_result.rows = [('col_1', 'type'), ('col_2', 'type2')]
     mock_query.return_value = db_result
     new_engine = MysqlEngine(instance=self.ins1)
     dbs = new_engine.get_all_columns_by_tb('some_db', 'some_tb')
     self.assertEqual(dbs, ['col_1', 'col_2'])
示例#2
0
 def testAllDb(self, mock_query):
     db_result = ResultSet()
     db_result.rows = [('db_1',), ('db_2',)]
     mock_query.return_value = db_result
     new_engine = MssqlEngine(instance=self.ins1)
     dbs = new_engine.get_all_databases()
     self.assertEqual(dbs, ['db_1', 'db_2'])
示例#3
0
 def testAllTables(self, mock_query):
     table_result = ResultSet()
     table_result.rows = [('tb_1', 'some_des'), ('tb_2', 'some_des')]
     mock_query.return_value = table_result
     new_engine = MysqlEngine(instance=self.ins1)
     tables = new_engine.get_all_tables('some_db')
     mock_query.assert_called_once_with(db_name='some_db', sql=ANY)
     self.assertEqual(tables, ['tb_1', 'tb_2'])