use anyhow::Result; use assert_cmd::Command; use common::{BIN, GNUPGHOME, PASSWORD_STORE_DIR}; use tempfile::tempdir; mod common; const KUBEPASSGEN: &str = r#" [opaque.namespace.name] "secret.file"="test_pass" "#; const EXPECTED: &str = r#"--- apiVersion: v1 kind: Secret type: Opaque metadata: name: name namespace: namespace data: secret.file: VGVzdFNlY3JldA== "#; #[test] fn opaque() -> Result<()> { let gpg_home = tempdir()?; let work_dir = tempdir()?; common::setup(&gpg_home, &work_dir, &KUBEPASSGEN)?; Command::cargo_bin(BIN)? .env(GNUPGHOME, gpg_home.path()) .env(PASSWORD_STORE_DIR, work_dir.path().join(".password-store")) .current_dir(work_dir.path()) .arg("secrets") .assert() .success() .stdout(EXPECTED); Ok(()) }