()
| 2005 | |
| 2006 | #[tokio::test] |
| 2007 | async fn task_child_run_permission_allow() { |
| 2008 | let workspace = tempfile::tempdir().unwrap(); |
| 2009 | let mock = Arc::new(MockLlmClient::new(vec![ |
| 2010 | MockLlmClient::tool_call_response( |
| 2011 | "t1", |
| 2012 | "write", |
| 2013 | serde_json::json!({ |
| 2014 | "file_path": workspace.path().join("out.txt").to_string_lossy(), |
| 2015 | "content": "WRITTEN" |
| 2016 | }), |
| 2017 | ), |
| 2018 | MockLlmClient::text_response("Done."), |
| 2019 | ])); |
| 2020 | |
| 2021 | let executor = TaskExecutor::new( |
| 2022 | test_registry_with_writer(), |
| 2023 | mock, |
| 2024 | workspace.path().to_string_lossy().to_string(), |
| 2025 | ); |
| 2026 | |
| 2027 | let result = executor |
| 2028 | .execute( |
| 2029 | TaskParams { |
| 2030 | agent: "writer".to_string(), |
| 2031 | description: "Write file".to_string(), |
| 2032 | prompt: "Write out.txt".to_string(), |
| 2033 | background: false, |
| 2034 | max_steps: Some(3), |
| 2035 | }, |
| 2036 | None, |
| 2037 | None, |
| 2038 | ) |
| 2039 | .await |
| 2040 | .unwrap(); |
| 2041 | |
| 2042 | assert!( |
| 2043 | result.success, |
| 2044 | "child run should succeed: {}", |
| 2045 | result.output |
| 2046 | ); |
| 2047 | assert!( |
| 2048 | !result.output.contains("Permission denied"), |
| 2049 | "no permission denial: {}", |
| 2050 | result.output |
| 2051 | ); |
| 2052 | let content = std::fs::read_to_string(workspace.path().join("out.txt")).unwrap(); |
| 2053 | assert_eq!(content, "WRITTEN"); |
| 2054 | } |
| 2055 | |
| 2056 | #[tokio::test] |
| 2057 | async fn task_child_run_permission_deny() { |
nothing calls this directly
no test coverage detected