test: Fixed Windows CLI tests (forgot to add unix cfg check)
This commit is contained in:
@@ -11,11 +11,11 @@ use std::io::{self, IsTerminal, Read, Write};
|
|||||||
use std::panic::PanicHookInfo;
|
use std::panic::PanicHookInfo;
|
||||||
|
|
||||||
use crate::cli::wrap_and_run_command;
|
use crate::cli::wrap_and_run_command;
|
||||||
|
use crate::utils::persist_config_file;
|
||||||
use dialoguer::Editor;
|
use dialoguer::Editor;
|
||||||
use std::panic;
|
use std::panic;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use validator::Validate;
|
use validator::Validate;
|
||||||
use crate::utils::persist_config_file;
|
|
||||||
|
|
||||||
mod cli;
|
mod cli;
|
||||||
mod command;
|
mod command;
|
||||||
|
|||||||
+4
-4
@@ -20,10 +20,10 @@
|
|||||||
//! rc.validate().unwrap();
|
//! rc.validate().unwrap();
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use collections::HashSet;
|
|
||||||
use crate::providers::local::LocalProvider;
|
use crate::providers::local::LocalProvider;
|
||||||
use crate::providers::{SecretProvider, SupportedProvider};
|
use crate::providers::{SecretProvider, SupportedProvider};
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
|
use collections::HashSet;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::serde_as;
|
use serde_with::serde_as;
|
||||||
@@ -217,8 +217,9 @@ fn default_provider_exists(config: &Config) -> Result<(), ValidationError> {
|
|||||||
fn providers_names_are_unique(config: &Config) -> Result<(), ValidationError> {
|
fn providers_names_are_unique(config: &Config) -> Result<(), ValidationError> {
|
||||||
let mut names = HashSet::new();
|
let mut names = HashSet::new();
|
||||||
for provider in &config.providers {
|
for provider in &config.providers {
|
||||||
if let Some(name) = &provider.name {
|
if let Some(name) = &provider.name
|
||||||
if !names.insert(name) {
|
&& !names.insert(name)
|
||||||
|
{
|
||||||
let mut err = ValidationError::new("duplicate_provider_name");
|
let mut err = ValidationError::new("duplicate_provider_name");
|
||||||
err.message = Some(Cow::Borrowed(
|
err.message = Some(Cow::Borrowed(
|
||||||
"Provider names must be unique; duplicate found",
|
"Provider names must be unique; duplicate found",
|
||||||
@@ -226,7 +227,6 @@ fn providers_names_are_unique(config: &Config) -> Result<(), ValidationError> {
|
|||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use assert_cmd::prelude::*;
|
use assert_cmd::prelude::*;
|
||||||
use predicates::prelude::*;
|
use predicates::prelude::*;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
#[cfg(unix)]
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
@@ -106,9 +107,9 @@ exit 0
|
|||||||
.env("EDITOR", &editor)
|
.env("EDITOR", &editor)
|
||||||
.arg("config");
|
.arg("config");
|
||||||
|
|
||||||
cmd.assert()
|
cmd.assert().success().stdout(predicate::str::contains(
|
||||||
.success()
|
"Configuration updated successfully",
|
||||||
.stdout(predicate::str::contains("Configuration updated successfully"));
|
));
|
||||||
|
|
||||||
// Verify that the config file now contains the run_configs key
|
// Verify that the config file now contains the run_configs key
|
||||||
let cfg_path = xdg_cfg.join("gman").join("config.yml");
|
let cfg_path = xdg_cfg.join("gman").join("config.yml");
|
||||||
|
|||||||
Reference in New Issue
Block a user