(724dc03) Add -o <owner> flag to comment subcommand

This commit is contained in:
2026-05-15 16:32:03 +02:00
parent 443586a583
commit dd5692d0a3
4 changed files with 58 additions and 3 deletions
+48
View File
@@ -164,3 +164,51 @@ fn comment_creates_comments_directory() {
assert!(comments_dir.exists());
}
#[test]
fn comment_uses_owner_flag_when_provided() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
let uuid = create_ticket(&worklane, "backlog", "Owner Test");
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
cmd.current_dir(&temp.path())
.arg("comment")
.args([&uuid, "Test comment with owner"])
.arg("-o")
.arg("TestUser")
.assert()
.success();
let comments_dir = worklane.join("comments").join(&uuid);
let files: Vec<_> = fs::read_dir(&comments_dir)
.unwrap()
.filter_map(|e| e.ok())
.collect();
let content = fs::read_to_string(files[0].path()).unwrap();
assert!(content.contains("**Author**: TestUser"));
}
#[test]
fn comment_falls_back_to_git_user_when_owner_omitted() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
let uuid = create_ticket(&worklane, "done", "Fallback Test");
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
cmd.current_dir(&temp.path())
.arg("comment")
.args([&uuid, "Test comment fallback"])
.assert()
.success();
let comments_dir = worklane.join("comments").join(&uuid);
let files: Vec<_> = fs::read_dir(&comments_dir)
.unwrap()
.filter_map(|e| e.ok())
.collect();
let content = fs::read_to_string(files[0].path()).unwrap();
assert!(content.contains("**Author**"));
}