Remote directory path in authentication form and in bookmarks parameters

This commit is contained in:
veeso
2022-05-03 15:22:25 +02:00
committed by Christian Visintin
parent e0d8b80cdf
commit 2caa0432df
10 changed files with 184 additions and 30 deletions

View File

@@ -404,6 +404,10 @@ mod tests {
assert_eq!(host.protocol, FileTransferProtocol::Sftp);
assert_eq!(host.username.as_deref().unwrap(), "cvisintin");
assert_eq!(host.password.as_deref().unwrap(), "mysecret");
assert_eq!(
host.directory.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
let host: &Bookmark = hosts.bookmarks.get("aws-server-prod1").unwrap();
assert_eq!(host.address.as_deref().unwrap(), "51.23.67.12");
assert_eq!(host.port.unwrap(), 21);
@@ -448,6 +452,7 @@ mod tests {
protocol: FileTransferProtocol::Sftp,
username: Some(String::from("root")),
password: None,
directory: None,
s3: None,
},
);
@@ -459,6 +464,7 @@ mod tests {
protocol: FileTransferProtocol::Sftp,
username: Some(String::from("cvisintin")),
password: Some(String::from("password")),
directory: Some(PathBuf::from("/tmp")),
s3: None,
},
);
@@ -470,6 +476,7 @@ mod tests {
protocol: FileTransferProtocol::AwsS3,
username: None,
password: None,
directory: None,
s3: Some(S3Params {
bucket: "veeso".to_string(),
region: Some("eu-west-1".to_string()),
@@ -490,6 +497,7 @@ mod tests {
protocol: FileTransferProtocol::Scp,
username: Some(String::from("omar")),
password: Some(String::from("aaa")),
directory: Some(PathBuf::from("/tmp")),
s3: None,
},
);
@@ -529,7 +537,7 @@ mod tests {
let file_content: &str = r#"
[bookmarks]
raspberrypi2 = { address = "192.168.1.31", port = 22, protocol = "SFTP", username = "root", password = "mypassword" }
msi-estrem = { address = "192.168.1.30", port = 22, protocol = "SFTP", username = "cvisintin", password = "mysecret" }
msi-estrem = { address = "192.168.1.30", port = 22, protocol = "SFTP", username = "cvisintin", password = "mysecret", directory = "/tmp" }
aws-server-prod1 = { address = "51.23.67.12", port = 21, protocol = "FTPS", username = "aws001" }
[bookmarks.my-bucket]