Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions crates/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1233,13 +1233,64 @@ mod tests {
Commands::Bucket(args) => match args.command {
bucket::BucketCommands::Remove(arg) => {
assert_eq!(arg.target, "local/my-bucket");
assert!(!arg.force);
assert!(!arg.dangerous);
assert!(!arg.yes);
}
other => panic!("expected bucket remove command, got {:?}", other),
},
other => panic!("expected bucket command, got {:?}", other),
}
}

#[test]
fn cli_requires_complete_dangerous_bucket_remove_guards() {
let cli = Cli::try_parse_from([
"rc",
"bucket",
"remove",
"local/my-bucket",
"--force",
"--dangerous",
"--yes",
])
.expect("parse guarded bucket remove");
match cli.command {
Commands::Bucket(args) => match args.command {
bucket::BucketCommands::Remove(arg) => {
assert!(arg.force);
assert!(arg.dangerous);
assert!(arg.yes);
}
other => panic!("expected bucket remove command, got {other:?}"),
},
other => panic!("expected bucket command, got {other:?}"),
}

assert!(
Cli::try_parse_from([
"rc",
"bucket",
"remove",
"local/my-bucket",
"--dangerous",
"--yes",
])
.is_err()
);
assert!(
Cli::try_parse_from([
"rc",
"bucket",
"remove",
"local/my-bucket",
"--force",
"--dangerous",
])
.is_err()
);
}

#[test]
fn cli_accepts_object_remove_subcommand() {
let cli = Cli::try_parse_from([
Expand Down
Loading
Loading