All checks were successful
continuous-integration/drone/push Build is passing
Allows commit bodies to show up in release notes, this is something I'd prefer as my releases are usually short, and I'd like to see these as I don't use pull requests as often, and often miss the context, as I don't link to commits currently. Also fixes a lot of warnings and reintroduces failing tests, still not perfect, but better than before. Co-authored-by: kjuulh <contact@kjuulh.io> Co-committed-by: kjuulh <contact@kjuulh.io>
89 lines
2.0 KiB
Rust
89 lines
2.0 KiB
Rust
pub mod common;
|
|
|
|
use common::BufferUi;
|
|
use cuddle_please_commands::PleaseCommand;
|
|
use tracing_test::traced_test;
|
|
|
|
use crate::common::{assert_output, get_test_data_path};
|
|
|
|
#[allow(dead_code)]
|
|
fn get_base_args<'a>() -> Vec<&'a str> {
|
|
vec![
|
|
"cuddle-please",
|
|
"config",
|
|
"list",
|
|
"--no-vcs",
|
|
"--engine=local",
|
|
"--token=something",
|
|
]
|
|
}
|
|
|
|
const EXPECTED_OUTPUT: &str = r#"cuddle-config
|
|
PleaseConfig
|
|
owner: kjuulh
|
|
repository: cuddle-please
|
|
branch: main
|
|
api_url: https://some-example.gitea-instance
|
|
"#;
|
|
|
|
#[allow(dead_code)]
|
|
#[traced_test]
|
|
fn test_config_from_current_dir() {
|
|
let args = get_base_args();
|
|
let ui = &BufferUi::default();
|
|
let current_dir = get_test_data_path("cuddle-embed");
|
|
|
|
PleaseCommand::new_from_args(Some(ui), args)
|
|
.execute(Some(¤t_dir))
|
|
.unwrap();
|
|
|
|
assert_output(ui, EXPECTED_OUTPUT, "");
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[traced_test]
|
|
fn test_config_from_source_dir() {
|
|
let mut args = get_base_args();
|
|
let ui = &BufferUi::default();
|
|
let current_dir = get_test_data_path("cuddle-embed");
|
|
args.push("--source");
|
|
args.push(current_dir.to_str().unwrap());
|
|
|
|
PleaseCommand::new_from_args(Some(ui), args)
|
|
.execute(None)
|
|
.unwrap();
|
|
|
|
assert_output(ui, EXPECTED_OUTPUT, "");
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[traced_test]
|
|
fn test_config_from_stdin() {
|
|
let mut args = get_base_args();
|
|
let ui = &BufferUi::default();
|
|
let config = r#"
|
|
project:
|
|
owner: kjuulh
|
|
repository: cuddle-please
|
|
branch: main
|
|
settings:
|
|
api_url: https://some-example.gitea-instance"#;
|
|
|
|
args.push("--config-stdin");
|
|
PleaseCommand::new_from_args_with_stdin(Some(ui), args, || Ok(config.into()))
|
|
.execute(None)
|
|
.unwrap();
|
|
assert_output(ui, EXPECTED_OUTPUT, "");
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[traced_test]
|
|
fn test_config_fails_when_not_path_is_set() {
|
|
let args = get_base_args();
|
|
let ui = &BufferUi::default();
|
|
|
|
let res = PleaseCommand::new_from_args(Some(ui), args).execute(None);
|
|
|
|
assert!(res.is_err())
|
|
}
|