@@ -13,8 +13,7 @@ const TEST_NAMES: &[&str] = &[
1313 "test_q_mcp_import_help_command" ,
1414 "test_q_mcp_list_command" ,
1515 "test_q_mcp_list_help_command" ,
16- "test_q_mcp_status_help_command" ,
17- "test_add_and_remove_mcp_command"
16+ "test_q_mcp_status_help_command"
1817] ;
1918const TOTAL_TESTS : usize = TEST_NAMES . len ( ) ;
2019
@@ -118,7 +117,7 @@ fn test_mcp_remove_help_command() -> Result<(), Box<dyn std::error::Error>> {
118117 println ! ( "📝 END HELP RESPONSE" ) ;
119118
120119 // Verify tool execution prompt appears
121- assert ! ( help_response. contains( "🛠️ Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
120+ assert ! ( help_response. contains( "Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
122121 assert ! ( help_response. contains( "Allow this action?" ) && help_response. contains( "to trust (always allow) this tool for the session." ) , "Missing permission prompt" ) ;
123122 println ! ( "✅ Found tool execution permission prompt" ) ;
124123
@@ -172,7 +171,7 @@ fn test_q_mcp_add_help_command() -> Result<(), Box<dyn std::error::Error>> {
172171 println ! ( "✅ Found tool execution details" ) ;
173172
174173 // Verify tool execution prompt appears
175- assert ! ( response. contains( "🛠️ Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
174+ assert ! ( response. contains( "Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
176175 assert ! ( response. contains( "Allow this action?" ) && response. contains( "to trust (always allow) this tool for the session." ) , "Missing permission prompt" ) ;
177176 println ! ( "✅ Found tool execution permission prompt" ) ;
178177
@@ -229,7 +228,7 @@ fn test_q_mcp_help_command() -> Result<(), Box<dyn std::error::Error>> {
229228 println ! ( "📝 END HELP RESPONSE" ) ;
230229
231230 // Verify tool execution prompt appears
232- assert ! ( help_response. contains( "🛠️ Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
231+ assert ! ( help_response. contains( "Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
233232 assert ! ( help_response. contains( "Allow this action?" ) && help_response. contains( "to trust (always allow) this tool for the session." ) , "Missing permission prompt" ) ;
234233 println ! ( "✅ Found tool execution permission prompt" ) ;
235234
@@ -293,7 +292,7 @@ fn test_q_mcp_import_help_command() -> Result<(), Box<dyn std::error::Error>> {
293292 println ! ( "✅ Found tool execution details" ) ;
294293
295294 // Verify tool execution prompt appears
296- assert ! ( response. contains( "🛠️ Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
295+ assert ! ( response. contains( "Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
297296 assert ! ( response. contains( "Allow this action?" ) && response. contains( "to trust (always allow) this tool for the session." ) , "Missing permission prompt" ) ;
298297 println ! ( "✅ Found tool execution permission prompt" ) ;
299298
@@ -457,7 +456,7 @@ fn test_q_mcp_status_help_command() -> Result<(), Box<dyn std::error::Error>> {
457456 println ! ( "✅ Found tool execution details" ) ;
458457
459458 // Verify tool execution prompt appears
460- assert ! ( response. contains( "🛠️ Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
459+ assert ! ( response. contains( "Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
461460 assert ! ( response. contains( "Allow this action?" ) && response. contains( "to trust (always allow) this tool for the session." ) , "Missing permission prompt" ) ;
462461 println ! ( "✅ Found tool execution permission prompt" ) ;
463462
@@ -494,105 +493,3 @@ fn test_q_mcp_status_help_command() -> Result<(), Box<dyn std::error::Error>> {
494493
495494 Ok ( ( ) )
496495}
497-
498- #[ test]
499- #[ cfg( feature = "mcp" ) ]
500- fn test_add_and_remove_mcp_command ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
501- println ! ( "🔍 Testing q mcp add command..." ) ;
502-
503- // First install uv dependency before starting Q Chat
504- println ! ( "🔍 Installing uv dependency..." ) ;
505- std:: process:: Command :: new ( "pip3" )
506- . args ( [ "install" , "uv" , "--break-system-packages" ] )
507- . output ( )
508- . expect ( "Failed to install uv" ) ;
509- println ! ( "✅ uv dependency installed" ) ;
510-
511- let session = get_chat_session ( ) ;
512- let mut chat = session. lock ( ) . unwrap_or_else ( |poisoned| poisoned. into_inner ( ) ) ;
513-
514- // Execute mcp add command
515- println ! ( "🔍 Executing command: 'q mcp add --name aws-documentation --command uvx --args awslabs.aws-documentation-mcp-server@latest'" ) ;
516- let response = chat. execute_command ( "q mcp add --name aws-documentation --command uvx --args awslabs.aws-documentation-mcp-server@latest" ) ?;
517-
518- println ! ( "📝 Response: {} bytes" , response. len( ) ) ;
519- println ! ( "📝 RESPONSE:" ) ;
520- println ! ( "{}" , response) ;
521- println ! ( "📝 END RESPONSE" ) ;
522-
523- // Verify tool execution details
524- assert ! ( response. contains( "Using tool:" ) , "Missing using tool indicator" ) ;
525- assert ! ( response. contains( "q mcp add --name aws-documentation --command uvx --args awslabs.aws-documentation-mcp-server@latest" ) , "Missing full command" ) ;
526- assert ! ( response. contains( "Purpose:" ) , "Missing purpose description" ) ;
527- println ! ( "✅ Found tool execution details" ) ;
528-
529- // Verify tool execution prompt appears
530- assert ! ( response. contains( "🛠️ Using tool: execute_bash" ) , "Missing tool execution indicator" ) ;
531- assert ! ( response. contains( "Allow this action?" ) && response. contains( "to trust (always allow) this tool for the session." ) , "Missing permission prompt" ) ;
532- println ! ( "✅ Found tool execution permission prompt" ) ;
533-
534- // Allow the tool execution
535- let allow_response = chat. execute_command ( "y" ) ?;
536-
537- println ! ( "📝 Allow response: {} bytes" , allow_response. len( ) ) ;
538- println ! ( "📝 ALLOW RESPONSE:" ) ;
539- println ! ( "{}" , allow_response) ;
540- println ! ( "📝 END ALLOW RESPONSE" ) ;
541-
542- // Verify successful addition
543- assert ! ( allow_response. contains( "Added MCP server" ) && allow_response. contains( "'aws-documentation'" ) , "Missing success message" ) ;
544- assert ! ( allow_response. contains( "/Users/" ) && allow_response. contains( "/.aws/amazonq/mcp.json" ) , "Missing config file path" ) ;
545- println ! ( "✅ Found successful addition message" ) ;
546-
547- // Verify completion indicator
548- assert ! ( allow_response. contains( "Completed in" ) && allow_response. contains( "s" ) , "Missing completion time indicator" ) ;
549- println ! ( "✅ Found completion indicator" ) ;
550-
551- println ! ( "✅ All q mcp add command execution verified successfully" ) ;
552-
553- // Now test removing the MCP server
554- println ! ( "🔍 Executing remove command: 'q mcp remove --name aws-documentation'" ) ;
555- let remove_response = chat. execute_command ( "q mcp remove --name aws-documentation" ) ?;
556-
557- println ! ( "📝 Remove response: {} bytes" , remove_response. len( ) ) ;
558- println ! ( "📝 REMOVE RESPONSE:" ) ;
559- println ! ( "{}" , remove_response) ;
560- println ! ( "📝 END REMOVE RESPONSE" ) ;
561-
562- // Verify remove tool execution details
563- assert ! ( response. contains( "Using tool:" ) , "Missing using tool indicator" ) ;
564- assert ! ( remove_response. contains( "q mcp remove --name aws-documentation" ) , "Missing full remove command" ) ;
565- println ! ( "✅ Found remove tool execution details" ) ;
566-
567- // Verify remove tool execution prompt
568- assert ! ( remove_response. contains( "🛠️ Using tool: execute_bash" ) , "Missing remove tool execution indicator" ) ;
569- assert ! ( remove_response. contains( "Allow this action?" ) , "Missing remove permission prompt" ) ;
570- println ! ( "✅ Found remove tool execution permission prompt" ) ;
571-
572- // Allow the remove tool execution
573- let remove_allow_response = chat. execute_command ( "y" ) ?;
574-
575- println ! ( "📝 Remove allow response: {} bytes" , remove_allow_response. len( ) ) ;
576- println ! ( "📝 REMOVE ALLOW RESPONSE:" ) ;
577- println ! ( "{}" , remove_allow_response) ;
578- println ! ( "📝 END REMOVE ALLOW RESPONSE" ) ;
579-
580- // Verify successful removal
581- assert ! ( remove_allow_response. contains( "Removed MCP server" ) && remove_allow_response. contains( "'aws-documentation'" ) , "Missing removal success message" ) ;
582- assert ! ( remove_allow_response. contains( "/Users/" ) && remove_allow_response. contains( "/.aws/amazonq/mcp.json" ) , "Missing config file path in removal" ) ;
583- println ! ( "✅ Found successful removal message" ) ;
584-
585- // Verify remove completion indicator
586- assert ! ( remove_allow_response. contains( "Completed in" ) && remove_allow_response. contains( "s" ) , "Missing remove completion time indicator" ) ;
587- println ! ( "✅ Found remove completion indicator" ) ;
588-
589- println ! ( "✅ All q mcp remove command execution verified successfully" ) ;
590-
591- // Release the lock before cleanup
592- drop ( chat) ;
593-
594- // Cleanup only if this is the last test
595- cleanup_if_last_test ( & TEST_COUNT , TOTAL_TESTS ) ?;
596-
597- Ok ( ( ) )
598- }
0 commit comments