11from unittest .mock import MagicMock , patch
22
3- import pytest
43from stackone_ai .models import ExecuteConfig , ToolDefinition , ToolParameters
5- from stackone_ai .toolset import StackOneToolSet , ToolsetLoadError
4+ from stackone_ai .toolset import StackOneToolSet
65
76
87def test_toolset_initialization ():
@@ -11,7 +10,7 @@ def test_toolset_initialization():
1110 "paths" : {
1211 "/employee/{id}" : {
1312 "get" : {
14- "operationId" : "get_employee " ,
13+ "operationId" : "hris_get_employee " ,
1514 "summary" : "Get employee details" ,
1615 "parameters" : [
1716 {
@@ -41,7 +40,7 @@ def test_toolset_initialization():
4140 execute = ExecuteConfig (
4241 method = "GET" ,
4342 url = "https://api.stackone.com/employee/{id}" ,
44- name = "get_employee " ,
43+ name = "hris_get_employee " ,
4544 headers = {},
4645 parameter_locations = {"id" : "path" },
4746 ),
@@ -56,20 +55,21 @@ def test_toolset_initialization():
5655 mock_path = MagicMock ()
5756 mock_path .exists .return_value = True
5857 mock_dir .__truediv__ .return_value = mock_path
58+ mock_dir .glob .return_value = [mock_path ]
5959
6060 # Setup parser mock
6161 mock_parser = MagicMock ()
6262 mock_parser .spec = mock_spec_content
63- mock_parser .parse_tools .return_value = {"get_employee " : mock_tool_def }
63+ mock_parser .parse_tools .return_value = {"hris_get_employee " : mock_tool_def }
6464 mock_parser_class .return_value = mock_parser
6565
6666 # Create and test toolset
6767 toolset = StackOneToolSet (api_key = "test_key" )
68- tools = toolset .get_tools (vertical = "hris " , account_id = "test_account" )
68+ tools = toolset .get_tools (filter_pattern = "hris_* " , account_id = "test_account" )
6969
7070 # Verify results
7171 assert len (tools ) == 1
72- tool = tools .get_tool ("get_employee " )
72+ tool = tools .get_tool ("hris_get_employee " )
7373 assert tool is not None
7474 assert tool .description == "Get employee details"
7575 assert tool ._api_key == "test_key"
@@ -80,8 +80,8 @@ def test_toolset_initialization():
8080 assert tool .parameters .properties ["id" ]["description" ] == "Employee ID"
8181
8282
83- def test_unknown_vertical ():
84- """Test getting tools for unknown vertical """
83+ def test_empty_filter_result ():
84+ """Test getting tools with a filter pattern that matches nothing """
8585 toolset = StackOneToolSet (api_key = "test_key" )
86- with pytest . raises ( ToolsetLoadError , match = "No spec file found for vertical: unknown" ):
87- toolset . get_tools ( vertical = "unknown" )
86+ tools = toolset . get_tools ( filter_pattern = "unknown_*" )
87+ assert len ( tools ) == 0
0 commit comments