Skip to content

Commit

Permalink
add distinct tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pengkang1991 authored Nov 29, 2023
1 parent a305fdc commit 5b64ce9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sql/engines/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,14 @@ def test_filter_sql(self):
banned_sql = "select user from user_table"
check_result = new_engine.filter_sql(sql=banned_sql, limit_num=10)
self.assertEqual(check_result, "select top 10 user from user_table")


def test_filter_sql_with_distinct(self):
new_engine = MssqlEngine(instance=self.ins1)
# 只抽查一个函数
banned_sql = "select distinct * from user_table"
check_result = new_engine.filter_sql(sql=banned_sql, limit_num=10)
self.assertEqual(check_result, "select distinct top 10 user from user_table")

def test_execute_check(self):
new_engine = MssqlEngine(instance=self.ins1)
test_sql = (
Expand Down

0 comments on commit 5b64ce9

Please sign in to comment.