Skip to content

Commit

Permalink
add unit test for Snowflake host/port extra parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
whummer committed Jun 24, 2024
1 parent 1c67479 commit 8fa38ec
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/profiles/snowflake/test_snowflake_user_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,27 @@ def test_appends_region() -> None:
"database": conn.extra_dejson.get("database"),
"warehouse": conn.extra_dejson.get("warehouse"),
}


def test_appends_host_and_port() -> None:
"""
Tests that host/port extras are appended to the connection settings.
"""
conn = Connection(
conn_id="my_snowflake_connection",
conn_type="snowflake",
login="my_user",
password="my_password",
schema="my_schema",
extra=json.dumps(
{
"host": "snowflake.localhost.localstack.cloud",
"port": 4566,
}
),
)

with patch("airflow.hooks.base.BaseHook.get_connection", return_value=conn):
profile_mapping = SnowflakeUserPasswordProfileMapping(conn)
assert profile_mapping.profile["host"] == "snowflake.localhost.localstack.cloud"
assert profile_mapping.profile["port"] == 4566

0 comments on commit 8fa38ec

Please sign in to comment.