Skip to content

Commit a7ceb3f

Browse files
DeanChensjcopybara-github
authored andcommitted
fix: Mock google.auth.default in test_fast_api.py
Patch google.auth.default to return a mock credential and a test project ID, ensuring tests don't rely on real authentication. Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 928943169
1 parent 342b59d commit a7ceb3f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tests/unittests/cli/test_fast_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ async def stream_query_impl(**kwargs):
957957
mock_adk_app_instance.stream_query = stream_query_impl
958958

959959
with (
960+
patch("google.auth.default", return_value=(MagicMock(), "test-project")),
960961
patch("vertexai.init", new_callable=MagicMock) as mock_vertexai_init,
961962
patch(
962963
"vertexai.agent_engines.AdkApp", return_value=mock_adk_app_instance

0 commit comments

Comments
 (0)