@@ -1788,3 +1788,31 @@ def test_execute_snowflake_query_real_connection(self, mock_snowflake_connect):
17881788 mock_cursor .close .assert_called_once ()
17891789 # Assert the result
17901790 self .assertEqual (result , mock_cursor .fetchall .return_value )
1791+
1792+ @mock .patch (PATH + "snowflake.connector.connect" )
1793+ @mock .patch .dict (
1794+ os .environ ,
1795+ {
1796+ "SNOWFLAKE_ACCOUNT" : "test_account" ,
1797+ "SNOWFLAKE_USER" : "test_user" ,
1798+ "SNOWFLAKE_ROLE" : "test_role" ,
1799+ "SNOWFLAKE_WAREHOUSE" : "test_wh" ,
1800+ "SNOWFLAKE_DATABASE" : "test_db" ,
1801+ "SNOWFLAKE_SCHEMA" : "PUBLIC" ,
1802+ "SNOWFLAKE_PRIVATE_KEY_FILE" : "test_key.pem" ,
1803+ },
1804+ )
1805+ @mock .patch ("os.path.exists" )
1806+ def test_get_snowflake_conn_jwt_auth (self , mock_exists , mock_connect ):
1807+ """Test get_snowflake_conn with JWT authentication."""
1808+ mock_exists .return_value = True
1809+ mock_connect .return_value = MagicMock ()
1810+
1811+ conn = d .get_snowflake_conn ()
1812+
1813+ # Verify connect was called with JWT authenticator
1814+ mock_connect .assert_called_once ()
1815+ call_args = mock_connect .call_args [1 ]
1816+ self .assertEqual (call_args ["authenticator" ], "SNOWFLAKE_JWT" )
1817+ self .assertEqual (call_args ["private_key_file" ], "test_key.pem" )
1818+ self .assertNotIn ("password" , call_args )
0 commit comments