Copybara import of the project:

--
0723b0915550a0af9d1eb2952ee193238eee8178 by Thiago Neves <thiagohneves@gmail.com>:

fix(tests): use mock GCS client in artifact service tests to avoid real credentials

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/601 from thiagoneves:fix/mock-gcs-client-in-tests e7d16719b9c3116b652988d2ed1b1f8893686f3e
PiperOrigin-RevId: 756381115
This commit is contained in:
Thiago Neves 2025-05-08 11:01:28 -07:00 committed by Copybara-Service
parent 85ccacbf2d
commit 5fd6a448de

View File

@ -21,6 +21,8 @@ from typing import Union
from google.adk.artifacts import GcsArtifactService
from google.adk.artifacts import InMemoryArtifactService
from google.genai import types
from unittest import mock
import pytest
Enum = enum.Enum
@ -136,9 +138,8 @@ class MockClient:
def mock_gcs_artifact_service():
"""Creates a mock GCS artifact service for testing."""
with mock.patch("google.cloud.storage.Client", return_value=MockClient()):
service = GcsArtifactService(bucket_name="test_bucket")
service.storage_client = MockClient()
service.bucket = service.storage_client.bucket("test_bucket")
return service