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

Function test_flow

crates/chat-cli/src/cli/chat/mod.rs:4030–4080  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4028
4029 #[tokio::test]
4030 async fn test_flow() {
4031 let mut os = Os::new().await.unwrap();
4032 os.client.set_mock_output(serde_json::json!([
4033 [
4034 "Sure, I'll create a file for you",
4035 {
4036 "tool_use_id": "1",
4037 "name": "fs_write",
4038 "args": {
4039 "command": "create",
4040 "file_text": "Hello, world!",
4041 "path": "/file.txt",
4042 }
4043 }
4044 ],
4045 [
4046 "Hope that looks good to you!",
4047 ],
4048 ]));
4049
4050 let agents = get_test_agents(&os).await;
4051 let tool_manager = ToolManager::default();
4052 let tool_config = serde_json::from_str::<HashMap<String, ToolSpec>>(include_str!("tools/tool_index.json"))
4053 .expect("Tools failed to load");
4054 ChatSession::new(
4055 &mut os,
4056 "fake_conv_id",
4057 agents,
4058 None,
4059 InputSource::new_mock(vec![
4060 "create a new file".to_string(),
4061 "y".to_string(),
4062 "exit".to_string(),
4063 ]),
4064 false,
4065 || Some(80),
4066 tool_manager,
4067 None,
4068 tool_config,
4069 true,
4070 false,
4071 None,
4072 )
4073 .await
4074 .unwrap()
4075 .spawn(&mut os)
4076 .await
4077 .unwrap();
4078
4079 assert_eq!(os.fs.read_to_string("/file.txt").await.unwrap(), "Hello, world!\n");
4080 }
4081
4082 #[tokio::test]
4083 async fn test_flow_tool_permissions() {

Callers

nothing calls this directly

Calls 3

get_test_agentsFunction · 0.85
set_mock_outputMethod · 0.80
spawnMethod · 0.45

Tested by

no test coverage detected