File tree Expand file tree Collapse file tree
packages/toolbox-adk/tests/integration Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616import os
1717from typing import Any , Optional
1818from inspect import signature , Parameter
19- from unittest .mock import MagicMock
19+ from unittest .mock import MagicMock , AsyncMock
2020
2121import pytest
2222from pydantic import ValidationError
@@ -192,12 +192,16 @@ async def test_3lo_flow_simulation(self):
192192 mock_ctx_first = MagicMock ()
193193 # Simulate "No Auth Response Found"
194194 mock_ctx_first .get_auth_response .return_value = None
195+ mock_cred_service_first = AsyncMock ()
196+ mock_cred_service_first .load_credential .return_value = None
197+ mock_ctx_first ._invocation_context = MagicMock ()
198+ mock_ctx_first ._invocation_context .credential_service = mock_cred_service_first
195199
196200 print ("Running tool first time (expecting auth request)..." )
197201 result_first = await tool .run_async ({"num_rows" : "1" }, mock_ctx_first )
198202
199203 # The wrapper should catch the missing creds and request them.
200- assert isinstance ( result_first , dict ) and "error" in result_first , "Tool should return error sig for auth requirement"
204+ assert result_first is None , "Tool should return None sig for auth requirement"
201205 mock_ctx_first .request_credential .assert_called_once ()
202206
203207 # Inspect the requested config
You can’t perform that action at this time.
0 commit comments