use std::process::Command;
fn filament_bin() -> std::path::PathBuf {
let mut path = std::env::current_exe().unwrap();
path.pop(); path.pop(); path.push("filament");
path
}
#[test]
fn devices_shows_granted_label() {
let bin = filament_bin();
let output = Command::new(&bin)
.arg("devices")
.output()
.expect("failed to execute filament");
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
stdout.contains("This is a local index; each device's own capability list is authoritative.")
|| stdout.contains("No devices yet."),
"Expected the devices state output, got: {}",
stdout
);
}
#[test]
fn addr_shows_granted_label() {
let bin = filament_bin();
let output = Command::new(&bin)
.arg("addr")
.arg("--json")
.output()
.expect("failed to execute filament");
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
output.status.success() || stdout.contains("{"),
"Expected valid JSON output from addr --json, got: {}",
&stdout[..stdout.len().min(200)]
);
}