File transfer exec command

This commit is contained in:
veeso
2021-03-04 16:07:08 +01:00
parent 88a014807f
commit 51f0c56b84
4 changed files with 158 additions and 1 deletions

View File

@@ -581,6 +581,15 @@ impl FileTransfer for FtpFileTransfer {
}
}
/// ### exec
///
/// Execute a command on remote host
fn exec(&mut self, _cmd: &str) -> Result<String, FileTransferError> {
Err(FileTransferError::new(
FileTransferErrorType::UnsupportedFeature,
))
}
/// ### send_file
///
/// Send file to remote
@@ -1068,6 +1077,19 @@ mod tests {
assert!(ftp.disconnect().is_ok());
}*/
#[test]
fn test_filetransfer_ftp_exec() {
let mut ftp: FtpFileTransfer = FtpFileTransfer::new(false);
// Connect
assert!(ftp
.connect(String::from("speedtest.tele2.net"), 21, None, None)
.is_ok());
// Pwd
assert!(ftp.exec("echo 1;").is_err());
// Disconnect
assert!(ftp.disconnect().is_ok());
}
#[test]
fn test_filetransfer_ftp_uninitialized() {
let file: FsFile = FsFile {