@@ -99,36 +99,46 @@ def integration_tool_with_auth(mock_rest_api_tool):
9999 )
100100
101101
102- def test_get_declaration (integration_tool ):
103- """Tests the generation of the function declaration."""
104- declaration = integration_tool ._get_declaration ()
105-
106- assert isinstance (declaration , FunctionDeclaration )
107- assert declaration .name == "test_integration_tool"
108- assert declaration .description == "Test integration tool description."
109-
110- # Check parameters schema
111- params = declaration .parameters
112- assert isinstance (params , Schema )
113- print (f"params: { params } " )
114- assert params .type == Type .OBJECT
115-
116- # Check properties (excluded fields should not be present)
117- assert "user_id" in params .properties
118- assert "connection_name" not in params .properties
119- assert "host" not in params .properties
120- assert "service_name" not in params .properties
121- assert "entity" not in params .properties
122- assert "operation" not in params .properties
123- assert "action" not in params .properties
124- assert "page_size" in params .properties
125- assert "filter" in params .properties
126-
127- # Check required fields (optional and excluded fields should not be required)
128- assert "user_id" in params .required
129- assert "page_size" not in params .required
130- assert "filter" not in params .required
131- assert "connection_name" not in params .required
102+ class TestIntegrationConnectorToolLegacy :
103+
104+ @pytest .fixture (autouse = True )
105+ def disable_feature_flag (self ):
106+ """Disable the JSON_SCHEMA_FOR_FUNC_DECL feature flag for legacy tests."""
107+ with temporary_feature_override (
108+ FeatureName .JSON_SCHEMA_FOR_FUNC_DECL , False
109+ ):
110+ yield
111+
112+ def test_get_declaration (self , integration_tool ):
113+ """Tests the generation of the function declaration."""
114+ declaration = integration_tool ._get_declaration ()
115+
116+ assert isinstance (declaration , FunctionDeclaration )
117+ assert declaration .name == "test_integration_tool"
118+ assert declaration .description == "Test integration tool description."
119+
120+ # Check parameters schema
121+ params = declaration .parameters
122+ assert isinstance (params , Schema )
123+ print (f"params: { params } " )
124+ assert params .type == Type .OBJECT
125+
126+ # Check properties (excluded fields should not be present)
127+ assert "user_id" in params .properties
128+ assert "connection_name" not in params .properties
129+ assert "host" not in params .properties
130+ assert "service_name" not in params .properties
131+ assert "entity" not in params .properties
132+ assert "operation" not in params .properties
133+ assert "action" not in params .properties
134+ assert "page_size" in params .properties
135+ assert "filter" in params .properties
136+
137+ # Check required fields (optional and excluded fields should not be required)
138+ assert "user_id" in params .required
139+ assert "page_size" not in params .required
140+ assert "filter" not in params .required
141+ assert "connection_name" not in params .required
132142
133143
134144@pytest .mark .asyncio
@@ -258,21 +268,27 @@ async def test_run_with_auth_async(
258268 assert result == {"status" : "success" , "data" : "mock_data" }
259269
260270
261- def test_get_declaration_with_json_schema_feature_enabled (integration_tool ):
262- """Tests the generation of the function declaration with JSON schema feature enabled."""
263- with temporary_feature_override (FeatureName .JSON_SCHEMA_FOR_FUNC_DECL , True ):
264- declaration = integration_tool ._get_declaration ()
271+ class TestIntegrationConnectorToolWithJsonSchema :
265272
266- assert isinstance (declaration , FunctionDeclaration )
267- assert declaration .name == "test_integration_tool"
268- assert declaration .description == "Test integration tool description."
269- assert declaration .parameters is None
270- assert declaration .parameters_json_schema == {
271- "type" : "object" ,
272- "properties" : {
273- "user_id" : {"type" : "string" , "description" : "User ID" },
274- "page_size" : {"type" : "integer" },
275- "filter" : {"type" : "string" },
276- },
277- "required" : ["user_id" ],
278- }
273+ def test_get_declaration_with_json_schema_feature_enabled (
274+ self , integration_tool
275+ ):
276+ """Tests the generation of the function declaration with JSON schema feature enabled."""
277+ with temporary_feature_override (
278+ FeatureName .JSON_SCHEMA_FOR_FUNC_DECL , True
279+ ):
280+ declaration = integration_tool ._get_declaration ()
281+
282+ assert isinstance (declaration , FunctionDeclaration )
283+ assert declaration .name == "test_integration_tool"
284+ assert declaration .description == "Test integration tool description."
285+ assert declaration .parameters is None
286+ assert declaration .parameters_json_schema == {
287+ "type" : "object" ,
288+ "properties" : {
289+ "user_id" : {"type" : "string" , "description" : "User ID" },
290+ "page_size" : {"type" : "integer" },
291+ "filter" : {"type" : "string" },
292+ },
293+ "required" : ["user_id" ],
294+ }
0 commit comments