MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / get_test_agents

Function get_test_agents

crates/chat-cli/src/cli/chat/mod.rs:4001–4027  ·  view source on GitHub ↗
(os: &Os)

Source from the content-addressed store, hash-verified

3999 use crate::cli::agent::Agent;
4000
4001 async fn get_test_agents(os: &Os) -> Agents {
4002 const AGENT_PATH: &str = "/persona/TestAgent.json";
4003 let mut agents = Agents::default();
4004 let agent = Agent {
4005 path: Some(PathBuf::from(AGENT_PATH)),
4006 ..Default::default()
4007 };
4008 if let Ok(false) = os.fs.try_exists(AGENT_PATH).await {
4009 let content = agent.to_str_pretty().expect("Failed to serialize test agent to file");
4010 let agent_path = PathBuf::from(AGENT_PATH);
4011 os.fs
4012 .create_dir_all(
4013 agent_path
4014 .parent()
4015 .expect("Failed to obtain parent path for agent config"),
4016 )
4017 .await
4018 .expect("Failed to create test agent dir");
4019 os.fs
4020 .write(agent_path, &content)
4021 .await
4022 .expect("Failed to write test agent to file");
4023 }
4024 agents.agents.insert("TestAgent".to_string(), agent);
4025 agents.switch("TestAgent").expect("Failed to switch agent");
4026 agents
4027 }
4028
4029 #[tokio::test]
4030 async fn test_flow() {

Callers 5

test_flowFunction · 0.85
test_flow_multiple_toolsFunction · 0.85
test_subscribe_flowFunction · 0.85

Calls 7

try_existsMethod · 0.80
to_str_prettyMethod · 0.80
create_dir_allMethod · 0.80
insertMethod · 0.80
to_stringMethod · 0.80
switchMethod · 0.80
writeMethod · 0.45

Tested by 5

test_flowFunction · 0.68
test_flow_multiple_toolsFunction · 0.68
test_subscribe_flowFunction · 0.68