mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Unable to acquire impersonated credentials
Merge https://github.com/google/adk-python/pull/2003 add scope "https://www.googleapis.com/auth/cloud-platform" within google.auth.default COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2003 from hsuyuming:fix/issue_2001_support_impersonated_credential 8874a367273aca98460f7f250bfc4690f883ebbe PiperOrigin-RevId: 788656025
This commit is contained in:
committed by
Copybara-Service
parent
de6ebddcd2
commit
9db5d9a3e8
+5
-1
@@ -604,11 +604,15 @@ class TestConnectionsClient:
|
||||
mock.patch(
|
||||
"google.adk.tools.application_integration_tool.clients.connections_client.default_service_credential",
|
||||
return_value=(mock_credentials, "test_project_id"),
|
||||
),
|
||||
) as mock_default_service_credential,
|
||||
mock.patch.object(mock_credentials, "refresh", return_value=None),
|
||||
):
|
||||
token = client._get_access_token()
|
||||
assert token == "test_token"
|
||||
# Verify default_service_credential is called with the correct scopes parameter
|
||||
mock_default_service_credential.assert_called_once_with(
|
||||
scopes=["https://www.googleapis.com/auth/cloud-platform"]
|
||||
)
|
||||
|
||||
def test_get_access_token_no_valid_credentials(
|
||||
self, project, location, connection_name
|
||||
|
||||
+5
-1
@@ -537,7 +537,7 @@ class TestIntegrationClient:
|
||||
mock.patch(
|
||||
"google.adk.tools.application_integration_tool.clients.integration_client.default_service_credential",
|
||||
return_value=(mock_credentials, "test_project_id"),
|
||||
),
|
||||
) as mock_default_service_credential,
|
||||
mock.patch.object(mock_credentials, "refresh", return_value=None),
|
||||
):
|
||||
client = IntegrationClient(
|
||||
@@ -552,6 +552,10 @@ class TestIntegrationClient:
|
||||
)
|
||||
token = client._get_access_token()
|
||||
assert token == "test_token"
|
||||
# Verify default_service_credential is called with the correct scopes parameter
|
||||
mock_default_service_credential.assert_called_once_with(
|
||||
scopes=["https://www.googleapis.com/auth/cloud-platform"]
|
||||
)
|
||||
|
||||
def test_get_access_token_no_valid_credentials(
|
||||
self, project, location, integration_name, triggers, connection_name
|
||||
|
||||
Reference in New Issue
Block a user