MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_cancel_confirmation

Function test_cancel_confirmation

core/src/hitl.rs:886–906  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

884
885 #[tokio::test]
886 async fn test_cancel_confirmation() {
887 let (event_tx, _) = broadcast::channel(100);
888 let manager = ConfirmationManager::new(ConfirmationPolicy::enabled(), event_tx);
889
890 // Request confirmation
891 let rx = manager
892 .request_confirmation("tool-1", "bash", &serde_json::json!({}))
893 .await;
894
895 assert_eq!(manager.pending_count().await, 1);
896
897 // Cancel confirmation
898 let cancelled = manager.cancel("tool-1").await;
899 assert!(cancelled);
900 assert_eq!(manager.pending_count().await, 0);
901
902 // Check response indicates cancellation
903 let response = rx.await.unwrap();
904 assert!(!response.approved);
905 assert_eq!(response.reason, Some("Confirmation cancelled".to_string()));
906 }
907
908 #[tokio::test]
909 async fn test_cancel_nonexistent() {

Callers

nothing calls this directly

Calls 2

request_confirmationMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected