@@ -102,50 +102,44 @@ def test_configure_creates_omni_with_env_vars(self):
102102 @regression_test
103103 def test_configure_creates_omni_with_headers (self ):
104104 """Test that headers are parsed correctly into Omni model."""
105- # NOTE: This test currently fails due to bug in handle_mcp_configure (line 613)
106- # The implementation uses `args or []` which converts None to empty list,
107- # causing validation error. This will be fixed in Phase 4.
108- # For now, test that the error is caught properly.
109- result = handle_mcp_configure (
110- host = 'claude-desktop' ,
111- server_name = 'test-server' ,
112- command = None ,
113- args = None , # Will be converted to [] by current implementation (bug)
114- env = None ,
115- url = 'https://api.example.com' ,
116- headers = ['Authorization=Bearer token' , 'Content-Type=application/json' ],
117- no_backup = True ,
118- dry_run = False ,
119- auto_approve = False
120- )
105+ with patch ('hatch.cli_hatch.MCPHostConfigurationManager' ) as mock_manager :
106+ with patch ('hatch.cli_hatch.request_confirmation' , return_value = False ):
107+ result = handle_mcp_configure (
108+ host = 'claude-desktop' ,
109+ server_name = 'test-server' ,
110+ command = None ,
111+ args = None ,
112+ env = None ,
113+ url = 'https://api.example.com' ,
114+ headers = ['Authorization=Bearer token' , 'Content-Type=application/json' ],
115+ no_backup = True ,
116+ dry_run = False ,
117+ auto_approve = False
118+ )
121119
122- # Current implementation returns error due to args validation bug
123- # This will be fixed in Phase 4 to return 0
124- self .assertEqual (result , 1 )
120+ # Verify the function executed without errors (bug fixed in Phase 4)
121+ self .assertEqual (result , 0 )
125122
126123 @regression_test
127124 def test_configure_creates_omni_remote_server (self ):
128125 """Test that remote server arguments create correct Omni model."""
129- # NOTE: This test currently fails due to bug in handle_mcp_configure (line 613)
130- # The implementation uses `args or []` which converts None to empty list,
131- # causing validation error. This will be fixed in Phase 4.
132- # For now, test that the error is caught properly.
133- result = handle_mcp_configure (
134- host = 'claude-desktop' ,
135- server_name = 'remote-server' ,
136- command = None ,
137- args = None , # Will be converted to [] by current implementation (bug)
138- env = None ,
139- url = 'https://api.example.com' ,
140- headers = ['Auth=token' ],
141- no_backup = True ,
142- dry_run = False ,
143- auto_approve = False
144- )
126+ with patch ('hatch.cli_hatch.MCPHostConfigurationManager' ) as mock_manager :
127+ with patch ('hatch.cli_hatch.request_confirmation' , return_value = False ):
128+ result = handle_mcp_configure (
129+ host = 'claude-desktop' ,
130+ server_name = 'remote-server' ,
131+ command = None ,
132+ args = None ,
133+ env = None ,
134+ url = 'https://api.example.com' ,
135+ headers = ['Auth=token' ],
136+ no_backup = True ,
137+ dry_run = False ,
138+ auto_approve = False
139+ )
145140
146- # Current implementation returns error due to args validation bug
147- # This will be fixed in Phase 4 to return 0
148- self .assertEqual (result , 1 )
141+ # Verify the function executed without errors (bug fixed in Phase 4)
142+ self .assertEqual (result , 0 )
149143
150144 @regression_test
151145 def test_configure_omni_with_all_universal_fields (self ):
@@ -246,7 +240,7 @@ def test_configure_passes_host_specific_model_to_manager(self):
246240 mock_manager = MagicMock ()
247241 mock_manager_class .return_value = mock_manager
248242 mock_manager .configure_server .return_value = MagicMock (success = True , backup_path = None )
249-
243+
250244 with patch ('hatch.cli_hatch.request_confirmation' , return_value = True ):
251245 # Call configure command
252246 result = handle_mcp_configure (
@@ -261,15 +255,16 @@ def test_configure_passes_host_specific_model_to_manager(self):
261255 dry_run = False ,
262256 auto_approve = False
263257 )
264-
258+
265259 # Verify configure_server was called
266260 self .assertEqual (result , 0 )
267261 mock_manager .configure_server .assert_called_once ()
268-
269- # Verify the server_config argument is an MCPServerConfig instance
262+
263+ # Verify the server_config argument is a host-specific model instance
264+ # (MCPServerConfigClaude for claude-desktop host)
270265 call_args = mock_manager .configure_server .call_args
271266 server_config = call_args .kwargs ['server_config' ]
272- self .assertIsInstance (server_config , MCPServerConfig )
267+ self .assertIsInstance (server_config , MCPServerConfigClaude )
273268
274269
275270class TestReportingIntegration (unittest .TestCase ):
0 commit comments