mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Improved test coverage
This commit is contained in:
@@ -866,4 +866,31 @@ mod tests {
|
||||
// Disconnect
|
||||
assert!(ftp.disconnect().is_ok());
|
||||
}*/
|
||||
|
||||
#[test]
|
||||
fn test_filetransfer_ftp_uninitialized() {
|
||||
let file: FsFile = FsFile {
|
||||
name: String::from("omar.txt"),
|
||||
abs_path: PathBuf::from("/omar.txt"),
|
||||
last_change_time: SystemTime::UNIX_EPOCH,
|
||||
last_access_time: SystemTime::UNIX_EPOCH,
|
||||
creation_time: SystemTime::UNIX_EPOCH,
|
||||
size: 0,
|
||||
ftype: Some(String::from("txt")), // File type
|
||||
readonly: true,
|
||||
symlink: None, // UNIX only
|
||||
user: Some(0), // UNIX only
|
||||
group: Some(0), // UNIX only
|
||||
unix_pex: Some((6, 4, 4)), // UNIX only
|
||||
};
|
||||
let mut ftp: FtpFileTransfer = FtpFileTransfer::new(false);
|
||||
assert!(ftp.change_dir(Path::new("/tmp")).is_err());
|
||||
assert!(ftp.disconnect().is_err());
|
||||
assert!(ftp.list_dir(Path::new("/tmp")).is_err());
|
||||
assert!(ftp.mkdir(Path::new("/tmp")).is_err());
|
||||
assert!(ftp.pwd().is_err());
|
||||
assert!(ftp.stat(Path::new("/tmp")).is_err());
|
||||
assert!(ftp.recv_file(&file).is_err());
|
||||
assert!(ftp.send_file(&file, Path::new("/tmp/omar.txt")).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user