Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/providers/snowflake/hooks/test_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from parameterized import parameterized

from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
from airflow.utils.process_utils import patch_environ


class TestSnowflakeHook(unittest.TestCase):
Expand Down Expand Up @@ -121,10 +122,29 @@ def test_get_conn_params(self):
'role': 'af_role',
'authenticator': 'snowflake',
'session_parameters': {"QUERY_TAG": "This is a test hook"},
"application": "AIRFLOW",
}
assert self.db_hook.snowflake_conn_id == 'snowflake_default' # pylint: disable=no-member
assert conn_params_shouldbe == self.db_hook._get_conn_params()

def test_get_conn_params_env_variable(self):
conn_params_shouldbe = {
'user': 'user',
'password': 'pw',
'schema': 'public',
'database': 'db',
'account': 'airflow',
'warehouse': 'af_wh',
'region': 'af_region',
'role': 'af_role',
'authenticator': 'snowflake',
'session_parameters': {"QUERY_TAG": "This is a test hook"},
"application": "AIRFLOW_TEST",
}
with patch_environ({"AIRFLOW_SNOWFLAKE_PARTNER": 'AIRFLOW_TEST'}):
assert self.db_hook.snowflake_conn_id == 'snowflake_default' # pylint: disable=no-member
assert conn_params_shouldbe == self.db_hook._get_conn_params()

def test_get_conn(self):
assert self.db_hook.get_conn() == self.conn

Expand Down