Skip to content

Commit

Permalink
Moved sql_api_generate_jwt out of hooks folder (#31586)
Browse files Browse the repository at this point in the history
* Moved sql_api_generate_jwt out of hooks folder
  • Loading branch information
utkarsharma2 authored May 29, 2023
1 parent 55d3ecc commit c55f9ea
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion airflow/providers/snowflake/hooks/snowflake_sql_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from airflow import AirflowException
from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
from airflow.providers.snowflake.hooks.sql_api_generate_jwt import JWTGenerator
from airflow.providers.snowflake.utils.sql_api_generate_jwt import JWTGenerator


class SnowflakeSqlApiHook(SnowflakeHook):
Expand Down
1 change: 0 additions & 1 deletion airflow/providers/snowflake/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ hooks:
python-modules:
- airflow.providers.snowflake.hooks.snowflake
- airflow.providers.snowflake.hooks.snowflake_sql_api
- airflow.providers.snowflake.hooks.sql_api_generate_jwt

transfers:
- source-integration-name: Amazon Simple Storage Service (S3)
Expand Down
2 changes: 1 addition & 1 deletion tests/providers/snowflake/hooks/test_snowflake_sql_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def test_get_request_url_header_params(self, mock_get_header, mock_conn_param):

@mock.patch("airflow.providers.snowflake.hooks.snowflake_sql_api.SnowflakeSqlApiHook.get_private_key")
@mock.patch("airflow.providers.snowflake.hooks.snowflake_sql_api.SnowflakeSqlApiHook._get_conn_params")
@mock.patch("airflow.providers.snowflake.hooks.sql_api_generate_jwt.JWTGenerator.get_token")
@mock.patch("airflow.providers.snowflake.utils.sql_api_generate_jwt.JWTGenerator.get_token")
def test_get_headers(self, mock_get_token, mock_conn_param, mock_private_key):
"""Test get_headers method by mocking get_private_key and _get_conn_params method"""
mock_get_token.return_value = "newT0k3n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from cryptography.hazmat.primitives import serialization as crypto_serialization
from cryptography.hazmat.primitives.asymmetric import rsa

from airflow.providers.snowflake.hooks.sql_api_generate_jwt import JWTGenerator
from airflow.providers.snowflake.utils.sql_api_generate_jwt import JWTGenerator

_PASSWORD = "snowflake42"

Expand Down

0 comments on commit c55f9ea

Please sign in to comment.