Skip to content

Commit bb01532

Browse files
committed
test(cors): cover empty normalized bucket path
1 parent b5e4922 commit bb01532

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

crates/cli/src/commands/cors.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,4 +726,54 @@ mod tests {
726726

727727
assert!(cors_input_source(&args).is_err());
728728
}
729+
730+
#[tokio::test]
731+
async fn test_execute_list_rejects_empty_normalized_bucket_path() {
732+
let code = execute(
733+
CorsArgs {
734+
command: CorsCommands::List(BucketArg {
735+
path: "local///".to_string(),
736+
force: false,
737+
}),
738+
},
739+
OutputConfig::default(),
740+
)
741+
.await;
742+
743+
assert_eq!(code, ExitCode::UsageError);
744+
}
745+
746+
#[tokio::test]
747+
async fn test_execute_set_rejects_empty_normalized_bucket_path_before_reading_source() {
748+
let code = execute(
749+
CorsArgs {
750+
command: CorsCommands::Set(SetCorsArgs {
751+
path: "local///".to_string(),
752+
source: Some("missing-cors.json".to_string()),
753+
file: None,
754+
force: false,
755+
}),
756+
},
757+
OutputConfig::default(),
758+
)
759+
.await;
760+
761+
assert_eq!(code, ExitCode::UsageError);
762+
}
763+
764+
#[tokio::test]
765+
async fn test_execute_remove_rejects_empty_normalized_bucket_path() {
766+
let code = execute(
767+
CorsArgs {
768+
command: CorsCommands::Remove(BucketArg {
769+
path: "local///".to_string(),
770+
force: false,
771+
}),
772+
},
773+
OutputConfig::default(),
774+
)
775+
.await;
776+
777+
assert_eq!(code, ExitCode::UsageError);
778+
}
729779
}

0 commit comments

Comments
 (0)