You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
distant/tests/cli/action/exists.rs

38 lines
889 B
Rust

use crate::cli::fixtures::*;
use assert_cmd::Command;
use assert_fs::prelude::*;
use rstest::*;
#[rstest]
fn should_output_true_if_exists(mut action_cmd: CtxCommand<Command>) {
let temp = assert_fs::TempDir::new().unwrap();
// Create file
let file = temp.child("file");
file.touch().unwrap();
// distant action exists {path}
action_cmd
.args(&["exists", file.to_str().unwrap()])
.assert()
.success()
.stdout("true\n")
.stderr("");
}
#[rstest]
fn should_output_false_if_not_exists(mut action_cmd: CtxCommand<Command>) {
let temp = assert_fs::TempDir::new().unwrap();
// Don't create file
let file = temp.child("file");
// distant action exists {path}
action_cmd
.args(&["exists", file.to_str().unwrap()])
.assert()
.success()
.stdout("false\n")
.stderr("");
}