File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
packages/toolbox-core/tests Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -407,3 +407,32 @@ def token_handler_2():
407
407
match = f"Authentication source\\ (s\\ ) `{ AUTH_SERVICE } ` already registered in tool `{ TOOL_NAME } `." ,
408
408
):
409
409
authed_tool .add_auth_token_getters ({AUTH_SERVICE : token_handler_2 })
410
+
411
+
412
+ @pytest .mark .asyncio
413
+ async def test_load_tool_not_found_in_manifest (aioresponses , test_tool_str ):
414
+ """
415
+ Tests that load_tool raises an Exception when the requested tool name
416
+ is not found in the manifest returned by the server, using existing fixtures.
417
+ """
418
+ ACTUAL_TOOL_IN_MANIFEST = "actual_tool_abc"
419
+ REQUESTED_TOOL_NAME = "non_existent_tool_xyz"
420
+
421
+ manifest = ManifestSchema (
422
+ serverVersion = "0.0.0" ,
423
+ tools = {ACTUAL_TOOL_IN_MANIFEST : test_tool_str }
424
+ )
425
+
426
+ aioresponses .get (
427
+ f"{ TEST_BASE_URL } /api/tool/{ REQUESTED_TOOL_NAME } " ,
428
+ payload = manifest .model_dump (),
429
+ status = 200 ,
430
+ )
431
+
432
+ async with ToolboxClient (TEST_BASE_URL ) as client :
433
+ with pytest .raises (Exception , match = f"Tool '{ REQUESTED_TOOL_NAME } ' not found!" ):
434
+ await client .load_tool (REQUESTED_TOOL_NAME )
435
+
436
+ aioresponses .assert_called_once_with (
437
+ f"{ TEST_BASE_URL } /api/tool/{ REQUESTED_TOOL_NAME } " , method = 'GET'
438
+ )
You can’t perform that action at this time.
0 commit comments