aKode fase 5: test e snapshot adeguati alla rinomina, 429 distinto (ProviderRateLimited), cargo fmt dopo il cambio dei prefissi
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use super::*;
|
||||
use crate::McpServerPermissions;
|
||||
use crate::mcp::tests::test_elicitation_config;
|
||||
use async_channel::Receiver;
|
||||
use akode_protocol::models::PermissionProfile;
|
||||
use akode_protocol::protocol::GranularApprovalConfig;
|
||||
use async_channel::Receiver;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rmcp::model::ElicitRequestParams;
|
||||
use rmcp::model::ElicitationSchema;
|
||||
@@ -400,10 +400,7 @@ fn elicitation_fixture(
|
||||
ElicitationRequestRouter::default(),
|
||||
);
|
||||
let (tx_event, events) = async_channel::bounded(1);
|
||||
let sender = manager.make_sender(
|
||||
"independent-mcp".to_string(),
|
||||
Some(tx_event),
|
||||
);
|
||||
let sender = manager.make_sender("independent-mcp".to_string(), Some(tx_event));
|
||||
(manager, events, sender)
|
||||
}
|
||||
|
||||
@@ -661,10 +658,7 @@ async fn strict_auto_review_respects_explicit_elicitation_denials() {
|
||||
("independent-mcp", Some(json!(false))),
|
||||
("another-independent-mcp", None),
|
||||
] {
|
||||
let sender = manager.make_sender(
|
||||
server_name.into(),
|
||||
/*tx_event*/ None,
|
||||
);
|
||||
let sender = manager.make_sender(server_name.into(), /*tx_event*/ None);
|
||||
assert_eq!(
|
||||
send_elicitation(&sender, marker).await,
|
||||
ElicitationResponse {
|
||||
@@ -789,14 +783,8 @@ async fn reused_elicitation_senders_follow_each_servers_latest_permission_author
|
||||
/*lifecycle*/ None,
|
||||
ElicitationRequestRouter::default(),
|
||||
);
|
||||
let attached = manager.make_sender(
|
||||
"attached".to_string(),
|
||||
/*tx_event*/ None,
|
||||
);
|
||||
let hosted = manager.make_sender(
|
||||
"local".to_string(),
|
||||
/*tx_event*/ None,
|
||||
);
|
||||
let attached = manager.make_sender("attached".to_string(), /*tx_event*/ None);
|
||||
let hosted = manager.make_sender("local".to_string(), /*tx_event*/ None);
|
||||
|
||||
assert_eq!(
|
||||
send_elicitation(&attached, /*marker*/ None).await.action,
|
||||
@@ -863,11 +851,8 @@ fn verification_fixture(
|
||||
approval_policy: AskForApproval,
|
||||
reviewer: Option<Arc<RecordingReviewer>>,
|
||||
) -> (ElicitationRequestManager, Receiver<Event>, SendElicitation) {
|
||||
let mut config = test_elicitation_config(
|
||||
"codex_apps",
|
||||
approval_policy,
|
||||
PermissionProfile::Disabled,
|
||||
);
|
||||
let mut config =
|
||||
test_elicitation_config("codex_apps", approval_policy, PermissionProfile::Disabled);
|
||||
let mut catalog = crate::catalog::ResolvedMcpCatalog::builder();
|
||||
catalog.register(crate::catalog::McpServerRegistration::from_extension(
|
||||
"codex_apps".to_string(),
|
||||
@@ -883,20 +868,14 @@ fn verification_fixture(
|
||||
ElicitationRequestRouter::default(),
|
||||
);
|
||||
let (tx, events) = async_channel::bounded(1);
|
||||
let sender = manager.make_sender(
|
||||
"codex_apps".into(),
|
||||
Some(tx),
|
||||
);
|
||||
let sender = manager.make_sender("codex_apps".into(), Some(tx));
|
||||
(manager, events, sender)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn user_verification_cancels_when_no_app_can_receive_the_request() {
|
||||
let (manager, _, _) = verification_fixture(AskForApproval::OnRequest, /*reviewer*/ None);
|
||||
let sender = manager.make_sender(
|
||||
"codex_apps".into(),
|
||||
/*tx_event*/ None,
|
||||
);
|
||||
let sender = manager.make_sender("codex_apps".into(), /*tx_event*/ None);
|
||||
assert_eq!(
|
||||
sender(
|
||||
RequestId::Number(7),
|
||||
@@ -921,10 +900,7 @@ async fn user_verification_cancels_when_no_app_can_receive_the_request() {
|
||||
async fn user_verification_cancels_for_an_event_receiver_without_host_activation() {
|
||||
let (manager, _, _) = verification_fixture(AskForApproval::OnRequest, /*reviewer*/ None);
|
||||
let (tx, events) = async_channel::bounded(1);
|
||||
let sender = manager.make_sender(
|
||||
"codex_apps".into(),
|
||||
Some(tx),
|
||||
);
|
||||
let sender = manager.make_sender("codex_apps".into(), Some(tx));
|
||||
let response = tokio::time::timeout(
|
||||
std::time::Duration::from_secs(1),
|
||||
sender(
|
||||
@@ -968,10 +944,7 @@ async fn user_verification_rejects_attached_servers_even_if_they_use_the_plugin_
|
||||
config.mcp_server_catalog = catalog.build();
|
||||
}
|
||||
let (tx, events) = async_channel::bounded(1);
|
||||
let sender = manager.make_sender(
|
||||
name.into(),
|
||||
Some(tx),
|
||||
);
|
||||
let sender = manager.make_sender(name.into(), Some(tx));
|
||||
assert_eq!(
|
||||
sender(
|
||||
RequestId::Number(7),
|
||||
|
||||
Reference in New Issue
Block a user