arjav1528 commented on code in PR #60394:
URL: https://github.com/apache/airflow/pull/60394#discussion_r2706043769
##########
providers/google/tests/unit/google/cloud/hooks/test_cloud_run.py:
##########
@@ -259,6 +259,36 @@ def test_delete_job(self, mock_batch_service_client,
cloud_run_hook):
cloud_run_hook.delete_job(job_name=JOB_NAME, region=REGION,
project_id=PROJECT_ID)
cloud_run_hook._client.delete_job.assert_called_once_with(delete_request)
+ @mock.patch(
+
"airflow.providers.google.common.hooks.base_google.GoogleBaseHook.__init__",
+ new=mock_base_gcp_hook_default_project_id,
+ )
+ @mock.patch("airflow.providers.google.cloud.hooks.cloud_run.JobsClient")
+ def test_get_conn_with_transport(self, mock_jobs_client):
+ """Test that transport parameter is passed to JobsClient."""
+ hook = CloudRunHook(transport="rest")
+ hook.get_credentials = self.dummy_get_credentials
+ hook.get_conn()
+
+ mock_jobs_client.assert_called_once()
+ call_kwargs = mock_jobs_client.call_args[1]
+ assert call_kwargs["transport"] == "rest"
+
+ @mock.patch(
+
"airflow.providers.google.common.hooks.base_google.GoogleBaseHook.__init__",
+ new=mock_base_gcp_hook_default_project_id,
+ )
+ @mock.patch("airflow.providers.google.cloud.hooks.cloud_run.JobsClient")
+ def test_get_conn_without_transport(self, mock_jobs_client):
+ """Test that JobsClient is created with default 'grpc' transport when
not specified."""
+ hook = CloudRunHook()
+ hook.get_credentials = self.dummy_get_credentials
+ hook.get_conn()
+
+ mock_jobs_client.assert_called_once()
+ call_kwargs = mock_jobs_client.call_args[1]
+ assert call_kwargs["transport"] == "grpc"
Review Comment:
I. have applied all the suggested changes, do review the PR at your
availability
--
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]