Tests: a headless agent session without folders also refuses a save

The test for a headless agent session with no usable agent folder now also saves to a path outside
the agent folders, checks that the error names the missing write authority, and checks that no file
was written.
This commit is contained in:
dotCooCoo committed 2026-12-04 10:07:24 -08:00
1 parent 53365705f5
commit 991925227b
1 file changed
+4
+4
View File
@@ -165,6 +165,10 @@ fn a_headless_agent_session_without_usable_folders_reads_and_writes_nothing() {
std::fs::write(&outside, r#"<svg xmlns="http://www.w3.org/2000/svg" width="4" height="3"/>"#).unwrap();
let e = b.call("app.open", json!({"path": outside.to_string_lossy()})).unwrap_err();
assert!(e.contains("read authority is absent"), "{e}");
let saved = dir.file("saved.svg");
let e = b.call("app.save", json!({"path": saved.to_string_lossy()})).unwrap_err();
assert!(e.contains("write authority is absent"), "{e}");
assert!(!saved.exists(), "the refused save must not write the file");
// With Allow Agent Control off, the session is the ordinary headless fallback, as before.
fn control_off(dir: &Path) -> AgentSettings {