Skip to content

Commit

Permalink
remove redundant test
Browse files Browse the repository at this point in the history
  • Loading branch information
iireland-ii committed Nov 12, 2024
1 parent 639a330 commit d13693c
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions integrations/snowflake/tests/test_snowflake_table_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,56 +236,6 @@ def test_execute_sql_query(

assert result.equals(expected)

@patch(
"haystack_integrations.components.retrievers.snowflake.snowflake_table_retriever.snowflake.connector.connect"
)
def test_is_select_only(
self, mock_connect: MagicMock, snowflake_table_retriever: SnowflakeTableRetriever, caplog: LogCaptureFixture
) -> None:
mock_conn = MagicMock()
mock_cursor = MagicMock()
mock_conn.cursor.return_value = mock_cursor
mock_connect.return_value = mock_conn
mock_cursor.fetchall.side_effect = [
[("DATETIME", "ROLE_NAME", "USER", "USER_NAME", "GRANTED_BY")], # User roles
[
(
"DATETIME",
"SELECT",
"TABLE",
"LOCATIONS",
"ROLE",
"ROLE_NAME",
"GRANT_OPTION",
"GRANTED_BY",
)
], # Table privileges
]

query = "select * from locations"
result = snowflake_table_retriever._check_privilege(conn=mock_conn, user="test_user", query=query)
assert result

mock_cursor.fetchall.side_effect = [
[("DATETIME", "ROLE_NAME", "USER", "USER_NAME", "GRANTED_BY")], # User roles
[
(
"DATETIME",
"INSERT",
"TABLE",
"LOCATIONS",
"ROLE",
"ROLE_NAME",
"GRANT_OPTION",
"GRANTED_BY",
)
],
]

result = snowflake_table_retriever._check_privilege(conn=mock_conn, user="test_user", query=query)

assert not result

@patch(
"haystack_integrations.components.retrievers.snowflake.snowflake_table_retriever.snowflake.connector.connect"
)
Expand Down

0 comments on commit d13693c

Please sign in to comment.