@@ -133,6 +133,12 @@ def mock_core_tool(self, tool_schema_dict):
133133 )
134134 sync_mock .bind_params = Mock (return_value = new_mock_instance_for_methods )
135135
136+ sync_mock ._bound_params = {"mock_bound_param" : "mock_bound_value" }
137+ sync_mock ._required_authn_params = {"mock_auth_source" : ["mock_param" ]}
138+ sync_mock ._required_authz_tokens = ["mock_authz_token" ]
139+ sync_mock ._auth_service_token_getters = {"mock_service" : lambda : "mock_token" }
140+ sync_mock ._client_headers = {"mock_header" : "mock_header_value" }
141+
136142 return sync_mock
137143
138144 @pytest .fixture
@@ -168,6 +174,12 @@ def mock_core_sync_auth_tool(self, auth_tool_schema_dict):
168174 return_value = new_mock_instance_for_methods
169175 )
170176 sync_mock .bind_params = Mock (return_value = new_mock_instance_for_methods )
177+ sync_mock ._bound_params = {"mock_bound_param" : "mock_bound_value" }
178+ sync_mock ._required_authn_params = {"mock_auth_source" : ["mock_param" ]}
179+ sync_mock ._required_authz_tokens = ["mock_authz_token" ]
180+ sync_mock ._auth_service_token_getters = {"mock_service" : lambda : "mock_token" }
181+ sync_mock ._client_headers = {"mock_header" : "mock_header_value" }
182+
171183 return sync_mock
172184
173185 @pytest .fixture
@@ -317,3 +329,48 @@ async def to_thread_side_effect(func, *args, **kwargs_for_func):
317329
318330 assert mock_core_tool .call_count == 1
319331 assert mock_core_tool .call_args == call (** kwargs_to_run )
332+
333+ def test_toolbox_tool_properties (self , toolbox_tool , mock_core_tool ):
334+ """Tests that the properties correctly proxy to the core tool."""
335+ assert toolbox_tool ._bound_params == mock_core_tool ._bound_params
336+ assert (
337+ toolbox_tool ._required_authn_params == mock_core_tool ._required_authn_params
338+ )
339+ assert (
340+ toolbox_tool ._required_authz_tokens == mock_core_tool ._required_authz_tokens
341+ )
342+ assert (
343+ toolbox_tool ._auth_service_token_getters
344+ == mock_core_tool ._auth_service_token_getters
345+ )
346+ assert toolbox_tool ._client_headers == mock_core_tool ._client_headers
347+
348+ def test_toolbox_tool_add_auth_tokens_deprecated (
349+ self , auth_toolbox_tool , mock_core_sync_auth_tool
350+ ):
351+ """Tests the deprecated add_auth_tokens method."""
352+ auth_tokens = {"test-auth-source" : lambda : "test-token" }
353+ with pytest .warns (DeprecationWarning ):
354+ new_tool = auth_toolbox_tool .add_auth_tokens (auth_tokens )
355+
356+ # Check that the call was correctly forwarded to the new method on the core tool
357+ mock_core_sync_auth_tool .add_auth_token_getters .assert_called_once_with (
358+ auth_tokens
359+ )
360+ assert isinstance (new_tool , ToolboxTool )
361+
362+ def test_toolbox_tool_add_auth_token_deprecated (
363+ self , auth_toolbox_tool , mock_core_sync_auth_tool
364+ ):
365+ """Tests the deprecated add_auth_token method."""
366+ get_id_token = lambda : "test-token"
367+ with pytest .warns (DeprecationWarning ):
368+ new_tool = auth_toolbox_tool .add_auth_token (
369+ "test-auth-source" , get_id_token
370+ )
371+
372+ # Check that the call was correctly forwarded to the new method on the core tool
373+ mock_core_sync_auth_tool .add_auth_token_getters .assert_called_once_with (
374+ {"test-auth-source" : get_id_token }
375+ )
376+ assert isinstance (new_tool , ToolboxTool )
0 commit comments