diff --git a/providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py b/providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py index d4b4f16e5a70d..5535a5e35492b 100644 --- a/providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py +++ b/providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py @@ -191,7 +191,7 @@ def _get_field(self, extra_dict, field_name): @property def account_identifier(self) -> str: - """Returns snowflake account identifier.""" + """Get snowflake account identifier.""" conn_config = self._get_conn_params account_identifier = f"https://{conn_config['account']}" @@ -205,7 +205,7 @@ def get_oauth_token(self, conn_config: dict | None = None) -> str: if conn_config is None: conn_config = self._get_conn_params - url = f"{self.account_identifier}.snowflakecomputing.com/oauth/token-request" + url = f"https://{conn_config['account']}.snowflakecomputing.com/oauth/token-request" data = { "grant_type": "refresh_token", diff --git a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py index f22fde497b96c..ec384ddc5c8ce 100644 --- a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py +++ b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py @@ -908,7 +908,7 @@ def test_get_oauth_token(self, mock_conn_param, requests_post, mock_auth): hook = SnowflakeHook(snowflake_conn_id="mock_conn_id") hook.get_oauth_token(conn_config=CONN_PARAMS_OAUTH) requests_post.assert_called_once_with( - f"https://{CONN_PARAMS_OAUTH['account']}.{CONN_PARAMS_OAUTH['region']}.snowflakecomputing.com/oauth/token-request", + f"https://{CONN_PARAMS_OAUTH['account']}.snowflakecomputing.com/oauth/token-request", data={ "grant_type": "refresh_token", "refresh_token": CONN_PARAMS_OAUTH["refresh_token"], diff --git a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py index 7ef4172d54670..91fd14777bb5d 100644 --- a/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py +++ b/providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py @@ -368,7 +368,7 @@ def test_get_oauth_token(self, mock_conn_param, requests_post, mock_auth): with pytest.warns(expected_warning=AirflowProviderDeprecationWarning): hook.get_oauth_token(CONN_PARAMS_OAUTH) requests_post.assert_called_once_with( - f"https://{CONN_PARAMS_OAUTH['account']}.{CONN_PARAMS_OAUTH['region']}.snowflakecomputing.com/oauth/token-request", + f"https://{CONN_PARAMS_OAUTH['account']}.snowflakecomputing.com/oauth/token-request", data={ "grant_type": "refresh_token", "refresh_token": CONN_PARAMS_OAUTH["refresh_token"],