diff --git a/tests/test_nitro_cli_args.rs b/tests/test_nitro_cli_args.rs index 83eabbbd..89832862 100644 --- a/tests/test_nitro_cli_args.rs +++ b/tests/test_nitro_cli_args.rs @@ -297,6 +297,134 @@ mod test_nitro_cli_args { assert!(app.try_get_matches_from(args).is_ok()) } + #[test] + fn build_signed_enclave_correct_command_kms_key() { + let app = create_app!(); + let args = vec![ + "nitro cli", + "build-enclave", + "--docker-uri", + "dkr.ecr.us-east-1.amazonaws.com/stronghold-develss", + "--docker-dir", + "dir/", + "--output-file", + "image.eif", + "--signing-certificate", + "cert.pem", + "--kms-key-id", + "key_id", + ]; + + assert!(app.try_get_matches_from(args).is_ok()) + } + + #[test] + fn build_signed_enclave_correct_command_kms_key_and_region() { + let app = create_app!(); + let args = vec![ + "nitro cli", + "build-enclave", + "--docker-uri", + "dkr.ecr.us-east-1.amazonaws.com/stronghold-develss", + "--docker-dir", + "dir/", + "--output-file", + "image.eif", + "--signing-certificate", + "cert.pem", + "--kms-key-id", + "key_id", + "--kms-key-region", + "us-east-1", + ]; + + assert!(app.try_get_matches_from(args).is_ok()) + } + + #[test] + fn build_signed_enclave_no_key_and_kms_region() { + let app = create_app!(); + let args = vec![ + "nitro cli", + "build-enclave", + "--docker-uri", + "dkr.ecr.us-east-1.amazonaws.com/stronghold-develss", + "--docker-dir", + "dir/", + "--output-file", + "image.eif", + "--signing-certificate", + "cert.pem", + "--kms-key-region", + "us-east-1", + ]; + + assert!(app.try_get_matches_from(args).is_err()) + } + + #[test] + fn build_signed_enclave_missing_certificate() { + let app = create_app!(); + let args = vec![ + "nitro cli", + "build-enclave", + "--docker-uri", + "dkr.ecr.us-east-1.amazonaws.com/stronghold-develss", + "--docker-dir", + "dir/", + "--output-file", + "image.eif", + "--private-key", + "key.pem", + ]; + + assert!(app.try_get_matches_from(args).is_err()) + } + + #[test] + fn build_signed_enclave_both_local_and_kms_key() { + let app = create_app!(); + let args = vec![ + "nitro cli", + "build-enclave", + "--docker-uri", + "dkr.ecr.us-east-1.amazonaws.com/stronghold-develss", + "--docker-dir", + "dir/", + "--output-file", + "image.eif", + "--signing-certificate", + "cert.pem", + "--private-key", + "key.pem", + "--kms-key-id", + "key_id", + ]; + + assert!(app.try_get_matches_from(args).is_err()) + } + + #[test] + fn build_signed_enclave_both_local_and_kms_key_missing_certificate() { + let app = create_app!(); + let args = vec![ + "nitro cli", + "build-enclave", + "--docker-uri", + "dkr.ecr.us-east-1.amazonaws.com/stronghold-develss", + "--docker-dir", + "dir/", + "--output-file", + "image.eif", + "--private-key", + "key.pem", + "--kms-key-id", + "key_id", + ]; + + assert!(app.try_get_matches_from(args).is_err()) + } + #[test] fn build_enclave_with_metadata_correct_command() { let app = create_app!();