utkarsharma2 commented on code in PR #31950:
URL: https://github.com/apache/airflow/pull/31950#discussion_r1231853148
##########
tests/providers/trino/hooks/test_trino.py:
##########
@@ -110,6 +112,31 @@ def test_get_conn_jwt_auth(self, mock_get_connection,
mock_connect, mock_jwt_aut
TrinoHook().get_conn()
self.assert_connection_called_with(mock_connect, auth=mock_jwt_auth)
+ @patch(JWT_AUTHENTICATION)
+ @patch(TRINO_DBAPI_CONNECT)
+ @patch(HOOK_GET_CONNECTION)
+ def test_get_conn_jwt_file(self, mock_get_connection, mock_connect,
mock_jwt_auth):
+
+ # Couldn't get this working with TemporaryFile, using
TemporaryDirectory instead
+ # Save a phony jwt to a temporary file for the trino hook to read from
+ with TemporaryDirectory() as tmp_dir:
+ tmp_jwt_file = os.path.join(tmp_dir, 'jwt.json')
+
+ with open(tmp_jwt_file, 'w') as tmp_file:
+ tmp_file.write('{"phony":"jwt"}')
+
+ extras = {
Review Comment:
Would be good to move lines 122 - 126 into a fixture, might be helpful for
future tests. :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]