@@ -44,8 +44,10 @@ def test_every_dialect_key_is_a_db_type():
4444 assert not unknown , f"denylist keys that no DB type uses: { sorted (unknown )} "
4545
4646
47- def test_postgres_functions_are_resolved_from_the_pg_type ():
48- functions = get_dangerous_functions (DB .pg .type )
47+ @pytest .mark .parametrize ("db" , [DB .pg , DB .excel , DB .kingbase ])
48+ def test_postgres_functions_are_resolved_from_pg_backed_types (db ):
49+ functions = get_dangerous_functions (db .type )
50+ assert PG_FILE_FUNCTIONS <= get_dangerous_functions (db .type .upper ())
4951 assert PG_FILE_FUNCTIONS <= functions
5052 assert COMMON_DANGEROUS_FUNCTIONS <= functions
5153
@@ -62,8 +64,9 @@ def test_postgres_functions_are_resolved_from_the_pg_type():
6264 "SELECT lo_export(1, '/tmp/out')" ,
6365 ],
6466)
65- def test_postgres_file_functions_are_rejected (sql ):
66- is_safe , reason = check_sql_read (sql , _ds (DB .pg ))
67+ @pytest .mark .parametrize ("db" , [DB .pg , DB .excel , DB .kingbase ])
68+ def test_postgres_file_functions_are_rejected (sql , db ):
69+ is_safe , reason = check_sql_read (sql , _ds (db ))
6770 assert not is_safe
6871 assert "dangerous function" in reason
6972
@@ -84,8 +87,9 @@ def test_postgres_write_statements_are_rejected(sql):
8487 assert not is_safe
8588
8689
87- def test_ordinary_postgres_select_is_still_allowed ():
88- is_safe , reason = check_sql_read ("SELECT id, name FROM users" , _ds (DB .pg ))
90+ @pytest .mark .parametrize ("db" , [DB .pg , DB .excel , DB .kingbase ])
91+ def test_ordinary_postgres_select_is_still_allowed (db ):
92+ is_safe , reason = check_sql_read ("SELECT id, name FROM users" , _ds (db ))
8993 assert is_safe , reason
9094
9195
0 commit comments