Skip to content

Commit 2699ad7

Browse files
xuanyang15copybara-github
authored andcommitted
chore: fix the test_llm_agent_fields.py by adding a mock for google.auth.default
PiperOrigin-RevId: 816319357
1 parent 4485379 commit 2699ad7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/unittests/agents/test_llm_agent_fields.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from typing import Any
1818
from typing import Optional
19+
from unittest import mock
1920

2021
from google.adk.agents.callback_context import CallbackContext
2122
from google.adk.agents.invocation_context import InvocationContext
@@ -341,6 +342,10 @@ async def test_function_tool_only(self):
341342
assert tools[0].name == '_my_tool'
342343
assert tools[0].__class__.__name__ == 'FunctionTool'
343344

345+
@mock.patch(
346+
'google.auth.default',
347+
mock.MagicMock(return_value=('credentials', 'project')),
348+
)
344349
async def test_handle_google_vais_with_other_tools(self):
345350
"""Test that VertexAiSearchTool is wrapped into an agent."""
346351
agent = LlmAgent(

0 commit comments

Comments
 (0)