diff --git a/airflow/providers/google/marketing_platform/hooks/analytics.py b/airflow/providers/google/marketing_platform/hooks/analytics.py index d4d5228c0a708..546ad29b709c1 100644 --- a/airflow/providers/google/marketing_platform/hooks/analytics.py +++ b/airflow/providers/google/marketing_platform/hooks/analytics.py @@ -31,13 +31,11 @@ class GoogleAnalyticsHook(GoogleBaseHook): def __init__( self, api_version: str = "v3", - gcp_conn_id: str = "google_cloud_default", *args, **kwargs ): super().__init__(*args, **kwargs) self.api_version = api_version - self.gcp_connection_is = gcp_conn_id self._conn = None def _paginate(self, resource: Resource, list_args: Optional[Dict[str, Any]] = None): diff --git a/tests/providers/google/marketing_platform/hooks/test_analytics.py b/tests/providers/google/marketing_platform/hooks/test_analytics.py index 5fc518823a0d5..c073e2916c881 100644 --- a/tests/providers/google/marketing_platform/hooks/test_analytics.py +++ b/tests/providers/google/marketing_platform/hooks/test_analytics.py @@ -26,7 +26,9 @@ ACCOUNT_ID = "the_knight_who_says_ni!" DATA_SOURCE = "Monthy Python" API_VERSION = "v3" -GCP_CONN_ID = "google_cloud_default" +GCP_CONN_ID = "test_gcp_conn_id" +DELEGATE_TO = "TEST_DELEGATE_TO" +IMPERSONATION_CHAIN = ["ACCOUNT_1", "ACCOUNT_2", "ACCOUNT_3"] class TestGoogleAnalyticsHook(unittest.TestCase): @@ -37,6 +39,21 @@ def setUp(self): ): self.hook = GoogleAnalyticsHook(API_VERSION, GCP_CONN_ID) + @mock.patch("airflow.providers.google.common.hooks.base_google.GoogleBaseHook.__init__") + def test_init(self, mock_base_init): + hook = GoogleAnalyticsHook( + API_VERSION, + GCP_CONN_ID, + delegate_to=DELEGATE_TO, + impersonation_chain=IMPERSONATION_CHAIN, + ) + mock_base_init.assert_called_once_with( + GCP_CONN_ID, + delegate_to=DELEGATE_TO, + impersonation_chain=IMPERSONATION_CHAIN, + ) + self.assertEqual(hook.api_version, API_VERSION) + @mock.patch( "airflow.providers.google.marketing_platform.hooks." "analytics.GoogleAnalyticsHook._authorize"