Fixed time check tests

This commit is contained in:
veeso
2021-01-09 14:29:30 +01:00
parent 49790b4704
commit fa5468be4a
2 changed files with 24 additions and 29 deletions

View File

@@ -705,6 +705,7 @@ impl FileTransfer for FtpFileTransfer {
mod tests {
use super::*;
use crate::utils::fmt::fmt_time;
use std::time::Duration;
#[test]
@@ -778,25 +779,16 @@ mod tests {
assert_eq!(file.group, Some(9));
assert_eq!(file.unix_pex.unwrap(), (7, 5, 5));
assert_eq!(
file.last_access_time
.duration_since(SystemTime::UNIX_EPOCH)
.ok()
.unwrap(),
Duration::from_secs(1604593920)
fmt_time(file.last_access_time, "%m %d %M").as_str(),
"11 05 32"
);
assert_eq!(
file.last_change_time
.duration_since(SystemTime::UNIX_EPOCH)
.ok()
.unwrap(),
Duration::from_secs(1604593920)
fmt_time(file.last_change_time, "%m %d %M").as_str(),
"11 05 32"
);
assert_eq!(
file.creation_time
.duration_since(SystemTime::UNIX_EPOCH)
.ok()
.unwrap(),
Duration::from_secs(1604593920)
fmt_time(file.creation_time, "%m %d %M").as_str(),
"11 05 32"
);
} else {
panic!("Expected file, got directory");