xvega commented on code in PR #71349:
URL: https://github.com/apache/airflow/pull/71349#discussion_r4579600441


##########
providers/google/tests/unit/google/cloud/hooks/test_kubernetes_engine.py:
##########
@@ -582,6 +590,212 @@ async def test_read_logs(self, read_namespaced_pod_log, 
get_conn_mock, async_hoo
         assert "Test string #1" in logs
         assert "Test string #2" in logs
 
+    @staticmethod
+    def _mock_token(tokens):
+        token = mock.AsyncMock()

Review Comment:
   Addressed!



##########
providers/google/tests/unit/google/cloud/hooks/test_kubernetes_engine.py:
##########
@@ -582,6 +590,212 @@ async def test_read_logs(self, read_namespaced_pod_log, 
get_conn_mock, async_hoo
         assert "Test string #1" in logs
         assert "Test string #2" in logs
 
+    @staticmethod
+    def _mock_token(tokens):
+        token = mock.AsyncMock()
+        token.get.side_effect = list(tokens)
+        return token
+
+    @pytest.mark.asyncio
+    @mock.patch(GKE_STRING.format("GKEKubernetesAsyncHook.get_token"), 
new_callable=mock.AsyncMock)
+    @mock.patch(GKE_STRING.format("GKEKubernetesAsyncHook._build_client"))
+    async def test_get_conn_caches_client_and_token(self, mock_build_client, 
mock_get_token, async_hook):
+        mock_get_token.return_value = self._mock_token(["token-1", "token-1"])
+        mock_build_client.return_value = mock.MagicMock(default_headers={})

Review Comment:
   Addressed!



-- 
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]

Reply via email to