mirror of
https://github.com/veeso/termscp.git
synced 2026-09-27 06:21:22 -07:00
issue 150: some issues with configuration (#151)
* issue 150: some issues with configuration
This commit is contained in:
@@ -645,7 +645,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_system_config_remote_ssh_config() {
|
||||
fn should_get_and_set_ssh_config_dir() {
|
||||
let tmp_dir: TempDir = TempDir::new().ok().unwrap();
|
||||
let (cfg_path, key_path): (PathBuf, PathBuf) = get_paths(tmp_dir.path());
|
||||
let mut client: ConfigClient = ConfigClient::new(cfg_path.as_path(), key_path.as_path())
|
||||
@@ -655,7 +655,14 @@ mod tests {
|
||||
let home_dir = dirs::home_dir().unwrap_or_else(|| PathBuf::from("/root"));
|
||||
let mut ssh_config_path = "~/.ssh/config".to_string();
|
||||
ssh_config_path = ssh_config_path.replacen('~', &home_dir.to_string_lossy(), 1);
|
||||
assert_eq!(client.get_ssh_config(), Some(ssh_config_path.as_str())); // Null ?
|
||||
|
||||
let ssh_config_path = if PathBuf::from(&ssh_config_path).exists() {
|
||||
Some(ssh_config_path)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
assert_eq!(client.get_ssh_config(), ssh_config_path.as_deref()); // Null ?
|
||||
client.set_ssh_config(Some(String::from("/tmp/ssh_config")));
|
||||
assert_eq!(client.get_ssh_config(), Some("/tmp/ssh_config"));
|
||||
client.set_ssh_config(None);
|
||||
|
||||
Reference in New Issue
Block a user