mik-laj commented on a change in pull request #8213: Fix issue #8163 where gcp 
auth fails
URL: https://github.com/apache/airflow/pull/8213#discussion_r408059997
 
 

 ##########
 File path: tests/providers/google/common/hooks/test_base_google.py
 ##########
 @@ -421,6 +421,19 @@ def 
test_get_credentials_and_project_id_with_default_auth_and_delegate(
         )
         self.assertEqual((mock_credentials, "PROJECT_ID"), result)
 
+    @mock.patch('google.auth.default')
+    def 
test_get_credentials_and_project_id_with_default_auth_and_unsupported_delegate(
+        self, mock_auth_default
+    ):
+        mock_credentials = 
mock.MagicMock(spec=google.auth.compute_engine.Credentials)
+        mock_auth_default.return_value = (mock_credentials, 
self.test_project_id)
+
+        with self.assertRaisesRegex(AirflowException, re.escape(
+            "The `delegate_to` parameter cannot be used here as the current 
authentication method does not "
+            "support account impersonate. Please use service-account for 
authorization."
+        )):
+            self.instance._get_credentials_and_project_id(delegate_to="USER")
 
 Review comment:
   ```suggestion
               self.instance._get_credentials_and_project_id()
   ```
   ```
   tests/providers/google/common/hooks/test_base_google.py:435:12: E1123: 
Unexpected keyword argument 'delegate_to' in method call 
(unexpected-keyword-arg)
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to