@@ -166,4 +166,102 @@ async def test_search_conan_packages_empty_query(mock_run_command, client_sessio
166166 mock_run_command .assert_called_once ()
167167 call_args = mock_run_command .call_args [0 ][0 ]
168168 assert "" in call_args # Empty string in command args
169+
170+
171+ @pytest .mark .anyio
172+ @patch ('main.run_command' )
173+ async def test_get_conan_profile_default (mock_run_command , client_session : ClientSession ):
174+ """Test get_conan_profile with default profile."""
175+ # Minimal conan profile response
176+ mock_profile = {
177+ "host" : {"settings" : {}},
178+ "build" : {"settings" : {}}
179+ }
180+ mock_run_command .return_value = str (mock_profile ).replace ("'" , '"' )
181+
182+ # Test calling the tool without profile parameter
183+ result = await client_session .call_tool ("get_conan_profile" , {})
169184
185+ # Check that we get a valid response structure
186+ assert isinstance (result , CallToolResult )
187+ assert len (result .content ) > 0
188+ assert isinstance (result .content [0 ], TextContent )
189+ assert result .content [0 ].type == "text"
190+
191+ # Basic sanity check: got some text back
192+ response_text = result .content [0 ].text
193+ assert isinstance (response_text , str )
194+
195+ # Verify the command was called correctly (no --profile flag)
196+ mock_run_command .assert_called_once ()
197+ call_args = mock_run_command .call_args [0 ][0 ]
198+ assert "conan" in call_args
199+ assert "profile" in call_args
200+ assert "show" in call_args
201+ assert "--format=json" in call_args
202+ assert "--profile" not in call_args
203+
204+
205+ @pytest .mark .anyio
206+ @patch ('main.run_command' )
207+ async def test_get_conan_profile_specific (mock_run_command , client_session : ClientSession ):
208+ """Test get_conan_profile with specific profile."""
209+ # Minimal conan profile response
210+ mock_profile = {
211+ "host" : {"settings" : {}},
212+ "build" : {"settings" : {}}
213+ }
214+ mock_run_command .return_value = str (mock_profile ).replace ("'" , '"' )
215+
216+ # Test calling the tool with specific profile
217+ result = await client_session .call_tool ("get_conan_profile" , {"profile" : "linux-debug" })
218+
219+ # Check that we get a valid response structure
220+ assert isinstance (result , CallToolResult )
221+ assert len (result .content ) > 0
222+ assert isinstance (result .content [0 ], TextContent )
223+ assert result .content [0 ].type == "text"
224+
225+ # Basic sanity check: got some text back
226+ response_text = result .content [0 ].text
227+ assert isinstance (response_text , str )
228+
229+ # Verify the command was called correctly (with --profile flag)
230+ mock_run_command .assert_called_once ()
231+ call_args = mock_run_command .call_args [0 ][0 ]
232+ assert "conan" in call_args
233+ assert "profile" in call_args
234+ assert "show" in call_args
235+ assert "--format=json" in call_args
236+ assert "--profile" in call_args
237+ assert "linux-debug" in call_args
238+
239+
240+ @pytest .mark .anyio
241+ @patch ('main.run_command' )
242+ async def test_list_conan_profiles (mock_run_command , client_session : ClientSession ):
243+ """Test listing conan profiles successfully."""
244+ mock_response = {
245+ "local" : [
246+ "default" ,
247+ "linux-debug" ,
248+ "macos-release"
249+ ]
250+ }
251+ mock_run_command .return_value = str (mock_response ).replace ("'" , '"' )
252+
253+ result = await client_session .call_tool ("list_conan_profiles" , {})
254+
255+ assert isinstance (result , CallToolResult )
256+ assert len (result .content ) > 0
257+ assert isinstance (result .content [0 ], TextContent )
258+
259+ response_text = result .content [0 ].text
260+ assert isinstance (response_text , str )
261+
262+ mock_run_command .assert_called_once ()
263+ call_args = mock_run_command .call_args [0 ][0 ]
264+ assert "conan" in call_args
265+ assert "profile" in call_args
266+ assert "list" in call_args
267+ assert "--format=json" in call_args
0 commit comments