use assert_cmd::prelude::*; use predicates::prelude::*; use rand; use std::process::Command; use rstest::*; use mtcs_garage::*; use hex; #[fixture] fn cmd() -> Command { Command::cargo_bin("credit5000").unwrap() } #[rstest] fn cli_showes_help(mut cmd: Command) -> Result<(), Box> { cmd.arg("--help"); cmd.assert().stdout(predicate::str::contains("Usage: credit5000")); Ok(()) } #[rstest] fn cli_stuff(mut cmd: Command) -> Result<(), Box> { let o = cmd.args([ "--secret", &hex::encode(rand::random::()), "--from", &hex::encode(rand::random::
()), "--to", &hex::encode(rand::random::
()), "--value", "1000", ]); cmd.assert().stdout(predicate::str::contains("coool")); Ok(()) }