@@ -27,8 +27,8 @@ def setup_class(self):
2727 self .communities_client = getattr (self .client , "communities" )
2828
2929
30- def test_get_by_id_request_structure (self ):
31- """Test get_by_id request structure."""
30+ def test_search_request_structure (self ):
31+ """Test search request structure."""
3232 # Mock the session to capture request details
3333 with patch .object (self .client , "session" ) as mock_session :
3434 mock_response = Mock ()
@@ -41,11 +41,11 @@ def test_get_by_id_request_structure(self):
4141 # Prepare test parameters
4242 kwargs = {}
4343 # Add required parameters
44- kwargs ["id " ] = "test_value "
44+ kwargs ["query " ] = "test_query "
4545 # Add request body if required
4646 # Call the method
4747 try :
48- method = getattr (self .communities_client , "get_by_id " )
48+ method = getattr (self .communities_client , "search " )
4949 result = method (** kwargs )
5050 # Check if this is a streaming operation (returns Generator)
5151 import types
@@ -80,7 +80,7 @@ def test_get_by_id_request_structure(self):
8080 called_url = (
8181 call_args [0 ][0 ] if call_args [0 ] else call_args [1 ].get ("url" , "" )
8282 )
83- expected_path = "/2/communities/{id} "
83+ expected_path = "/2/communities/search "
8484 assert expected_path .replace ("{" , "" ).replace (
8585 "}" , ""
8686 ) in called_url or any (
@@ -96,12 +96,12 @@ def test_get_by_id_request_structure(self):
9696 # For regular operations, verify we got a result
9797 assert result is not None , "Method should return a result"
9898 except Exception as e :
99- pytest .fail (f"Contract test failed for get_by_id : { e } " )
99+ pytest .fail (f"Contract test failed for search : { e } " )
100100
101101
102- def test_get_by_id_required_parameters (self ):
103- """Test that get_by_id handles parameters correctly."""
104- method = getattr (self .communities_client , "get_by_id " )
102+ def test_search_required_parameters (self ):
103+ """Test that search handles parameters correctly."""
104+ method = getattr (self .communities_client , "search " )
105105 # Test with missing required parameters - mock the request to avoid network calls
106106 with patch .object (self .client , "session" ) as mock_session :
107107 # Mock a 400 response (typical for missing required parameters)
@@ -115,8 +115,8 @@ def test_get_by_id_required_parameters(self):
115115 method ()
116116
117117
118- def test_get_by_id_response_structure (self ):
119- """Test get_by_id response structure validation."""
118+ def test_search_response_structure (self ):
119+ """Test search response structure validation."""
120120 with patch .object (self .client , "session" ) as mock_session :
121121 # Create mock response with expected structure
122122 mock_response_data = {
@@ -129,10 +129,10 @@ def test_get_by_id_response_structure(self):
129129 mock_session .get .return_value = mock_response
130130 # Prepare minimal valid parameters
131131 kwargs = {}
132- kwargs ["id " ] = "test "
132+ kwargs ["query " ] = "test_value "
133133 # Add request body if required
134134 # Call method and verify response structure
135- method = getattr (self .communities_client , "get_by_id " )
135+ method = getattr (self .communities_client , "search " )
136136 result = method (** kwargs )
137137 # Verify response object has expected attributes
138138 # Optional field - just check it doesn't cause errors if accessed
@@ -144,8 +144,8 @@ def test_get_by_id_response_structure(self):
144144 )
145145
146146
147- def test_search_request_structure (self ):
148- """Test search request structure."""
147+ def test_get_by_id_request_structure (self ):
148+ """Test get_by_id request structure."""
149149 # Mock the session to capture request details
150150 with patch .object (self .client , "session" ) as mock_session :
151151 mock_response = Mock ()
@@ -158,11 +158,11 @@ def test_search_request_structure(self):
158158 # Prepare test parameters
159159 kwargs = {}
160160 # Add required parameters
161- kwargs ["query " ] = "test_query "
161+ kwargs ["id " ] = "test_value "
162162 # Add request body if required
163163 # Call the method
164164 try :
165- method = getattr (self .communities_client , "search " )
165+ method = getattr (self .communities_client , "get_by_id " )
166166 result = method (** kwargs )
167167 # Check if this is a streaming operation (returns Generator)
168168 import types
@@ -197,7 +197,7 @@ def test_search_request_structure(self):
197197 called_url = (
198198 call_args [0 ][0 ] if call_args [0 ] else call_args [1 ].get ("url" , "" )
199199 )
200- expected_path = "/2/communities/search "
200+ expected_path = "/2/communities/{id} "
201201 assert expected_path .replace ("{" , "" ).replace (
202202 "}" , ""
203203 ) in called_url or any (
@@ -213,12 +213,12 @@ def test_search_request_structure(self):
213213 # For regular operations, verify we got a result
214214 assert result is not None , "Method should return a result"
215215 except Exception as e :
216- pytest .fail (f"Contract test failed for search : { e } " )
216+ pytest .fail (f"Contract test failed for get_by_id : { e } " )
217217
218218
219- def test_search_required_parameters (self ):
220- """Test that search handles parameters correctly."""
221- method = getattr (self .communities_client , "search " )
219+ def test_get_by_id_required_parameters (self ):
220+ """Test that get_by_id handles parameters correctly."""
221+ method = getattr (self .communities_client , "get_by_id " )
222222 # Test with missing required parameters - mock the request to avoid network calls
223223 with patch .object (self .client , "session" ) as mock_session :
224224 # Mock a 400 response (typical for missing required parameters)
@@ -232,8 +232,8 @@ def test_search_required_parameters(self):
232232 method ()
233233
234234
235- def test_search_response_structure (self ):
236- """Test search response structure validation."""
235+ def test_get_by_id_response_structure (self ):
236+ """Test get_by_id response structure validation."""
237237 with patch .object (self .client , "session" ) as mock_session :
238238 # Create mock response with expected structure
239239 mock_response_data = {
@@ -246,10 +246,10 @@ def test_search_response_structure(self):
246246 mock_session .get .return_value = mock_response
247247 # Prepare minimal valid parameters
248248 kwargs = {}
249- kwargs ["query " ] = "test_value "
249+ kwargs ["id " ] = "test "
250250 # Add request body if required
251251 # Call method and verify response structure
252- method = getattr (self .communities_client , "search " )
252+ method = getattr (self .communities_client , "get_by_id " )
253253 result = method (** kwargs )
254254 # Verify response object has expected attributes
255255 # Optional field - just check it doesn't cause errors if accessed
0 commit comments