def test_query_check_star_sql(self): sql = "select * from xx " new_engine = PgSQLEngine(instance=self.ins) check_result = new_engine.query_check(db_name='archery', sql=sql) self.assertDictEqual( check_result, { 'msg': 'SQL语句中含有 * ', 'bad_query': False, 'filtered_sql': sql.strip(), 'has_star': True })
def test_query_check_disable_sql(self): sql = "update xxx set a=1 " new_engine = PgSQLEngine(instance=self.ins) check_result = new_engine.query_check(db_name='archery', sql=sql) self.assertDictEqual( check_result, { 'msg': '不支持的查询语法类型!', 'bad_query': True, 'filtered_sql': sql.strip(), 'has_star': False })