test: fix mcp refresh flow after agent key scoping

This commit is contained in:
a.tolmachev
2026-05-03 16:24:30 +00:00
parent a28e6a55cb
commit 10433d5193
+12 -1
View File
@@ -145,6 +145,7 @@ mod tests {
use crank_registry::{ use crank_registry::{
CreateAgentRequest, CreateAsyncJobRequest, CreatePlatformApiKeyRequest, CreateAgentRequest, CreateAsyncJobRequest, CreatePlatformApiKeyRequest,
ListInvocationLogsQuery, PostgresRegistry, PublishAgentRequest, PublishRequest, ListInvocationLogsQuery, PostgresRegistry, PublishAgentRequest, PublishRequest,
SaveAgentBindingsRequest,
}; };
use crank_runtime::{ use crank_runtime::{
RequestRateLimitConfig, RequestRateLimiter, RuntimeExecutor, SecretCrypto, RequestRateLimitConfig, RequestRateLimiter, RuntimeExecutor, SecretCrypto,
@@ -1182,6 +1183,7 @@ mod tests {
.await; .await;
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let mcp_url = agent_mcp_url(&base_url, "sales-refresh"); let mcp_url = agent_mcp_url(&base_url, "sales-refresh");
publish_agent_with_bindings(&registry, "sales-refresh", vec![]).await;
let api_key = create_platform_api_key( let api_key = create_platform_api_key(
&registry, &registry,
"sales-refresh", "sales-refresh",
@@ -1220,7 +1222,15 @@ mod tests {
}) })
.await .await
.unwrap(); .unwrap();
publish_agent_for_operation(&registry, &operation, "sales-refresh").await; registry
.save_agent_bindings(SaveAgentBindingsRequest {
workspace_id: &test_workspace_id(),
agent_id: &test_agent_id("sales-refresh"),
agent_version: 1,
bindings: &[binding_for_operation(&operation)],
})
.await
.unwrap();
let after_publish = post_jsonrpc( let after_publish = post_jsonrpc(
&client, &client,
@@ -2482,6 +2492,7 @@ mod tests {
.send() .send()
.await .await
.unwrap(); .unwrap();
assert_eq!(initialize_response.status(), reqwest::StatusCode::OK);
let session_id = initialize_response let session_id = initialize_response
.headers() .headers()
.get("MCP-Session-Id") .get("MCP-Session-Id")