@@ -304,46 +304,46 @@ async def test_toolbox_tool_call_with_auth_tokens(self, auth_toolbox_tool):
304
304
305
305
async def test_toolbox_tool_call_with_auth_tokens_insecure (
306
306
self , auth_toolbox_tool , auth_tool_schema_dict
307
- ): # Add auth_tool_schema_dict fixture
307
+ ):
308
308
core_tool_of_auth_tool = auth_toolbox_tool ._AsyncToolboxTool__core_tool
309
309
mock_session = core_tool_of_auth_tool ._ToolboxTool__session
310
310
311
- # *** Fix: Use the injected fixture value auth_tool_schema_dict ***
312
- insecure_core_tool = self ._create_core_tool_from_dict (
313
- session = mock_session ,
314
- name = "test_tool" ,
315
- schema_dict = auth_tool_schema_dict , # Use the fixture value here
316
- url = "http://test-url" ,
317
- )
318
- insecure_auth_langchain_tool = AsyncToolboxTool (core_tool = insecure_core_tool )
319
-
320
311
with pytest .warns (
321
312
UserWarning ,
322
313
match = "Sending ID token over HTTP. User data may be exposed. Use HTTPS for secure communication." ,
323
314
):
324
- tool_with_getter = insecure_auth_langchain_tool .add_auth_token_getters (
325
- {"test-auth-source" : lambda : "test-token" }
315
+ insecure_core_tool = self ._create_core_tool_from_dict (
316
+ session = mock_session ,
317
+ name = "test_tool" ,
318
+ schema_dict = auth_tool_schema_dict ,
319
+ url = "http://test-url" ,
326
320
)
327
- result = await tool_with_getter .ainvoke ({"param2" : 123 })
328
- assert result == "test-result"
329
321
330
- modified_core_tool_in_new_tool = (
331
- tool_with_getter ._AsyncToolboxTool__core_tool
332
- )
333
- assert (
334
- modified_core_tool_in_new_tool ._ToolboxTool__base_url
335
- == "http://test-url"
336
- )
337
- assert (
338
- modified_core_tool_in_new_tool ._ToolboxTool__url
339
- == "http://test-url/api/tool/test_tool/invoke"
340
- )
322
+ insecure_auth_langchain_tool = AsyncToolboxTool (core_tool = insecure_core_tool )
341
323
342
- modified_core_tool_in_new_tool ._ToolboxTool__session .post .assert_called_once_with (
343
- "http://test-url/api/tool/test_tool/invoke" ,
344
- json = {"param2" : 123 },
345
- headers = {"test-auth-source_token" : "test-token" },
346
- )
324
+ tool_with_getter = insecure_auth_langchain_tool .add_auth_token_getters (
325
+ {"test-auth-source" : lambda : "test-token" }
326
+ )
327
+ result = await tool_with_getter .ainvoke ({"param2" : 123 })
328
+ assert result == "test-result"
329
+
330
+ modified_core_tool_in_new_tool = (
331
+ tool_with_getter ._AsyncToolboxTool__core_tool
332
+ )
333
+ assert (
334
+ modified_core_tool_in_new_tool ._ToolboxTool__base_url
335
+ == "http://test-url"
336
+ )
337
+ assert (
338
+ modified_core_tool_in_new_tool ._ToolboxTool__url
339
+ == "http://test-url/api/tool/test_tool/invoke"
340
+ )
341
+
342
+ modified_core_tool_in_new_tool ._ToolboxTool__session .post .assert_called_once_with (
343
+ "http://test-url/api/tool/test_tool/invoke" ,
344
+ json = {"param2" : 123 },
345
+ headers = {"test-auth-source_token" : "test-token" },
346
+ )
347
347
348
348
async def test_toolbox_tool_call_with_invalid_input (self , toolbox_tool ):
349
349
with pytest .raises (ValidationError ) as e :
0 commit comments