Skip to content

Commit

Permalink
Fix pickyness of google.auth 2.36.0 for mocks (apache#43771)
Browse files Browse the repository at this point in the history
Google-auth 2.36.0 is more picky about credentials being mocked. It
expects the `universe_domain` attribute to be real string not
mock because it passes it as argument of `replace` string method.
  • Loading branch information
potiuk authored Nov 7, 2024
1 parent df46f31 commit c83e72a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions providers/tests/google/common/hooks/test_base_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ async def test_get_token(self, mock_auth_default, monkeypatch) -> None:
async def test_get_token_impersonation(self, mock_auth_default, monkeypatch, requests_mock) -> None:
mock_credentials = mock.MagicMock(spec=google.auth.compute_engine.Credentials)
mock_credentials.token = "ACCESS_TOKEN"
mock_credentials.universe_domain = "googleapis.com"
mock_auth_default.return_value = (mock_credentials, "PROJECT_ID")
monkeypatch.setenv(
"AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT",
Expand All @@ -1045,6 +1046,7 @@ async def test_get_token_impersonation(self, mock_auth_default, monkeypatch, req
@mock.patch("google.auth.default")
async def test_get_token_impersonation_conn(self, mock_auth_default, monkeypatch, requests_mock) -> None:
mock_credentials = mock.MagicMock(spec=google.auth.compute_engine.Credentials)
mock_credentials.universe_domain = "googleapis.com"
mock_auth_default.return_value = (mock_credentials, "PROJECT_ID")
monkeypatch.setenv(
"AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT",
Expand Down

0 comments on commit c83e72a

Please sign in to comment.