Update to work around deprecated chrono API
This commit is contained in:
parent
71b6bac96a
commit
406f63e02e
|
@ -13,7 +13,7 @@ default = ["tokio-rustls"]
|
|||
[dependencies]
|
||||
async-trait = "0.1.52"
|
||||
celes = "2.1"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
chrono = { version = "0.4.23", features = ["serde"] }
|
||||
quick-xml = { version = "0.23", features = [ "serialize" ] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tokio = { version = "1.0", features = [ "full" ] }
|
||||
|
|
|
@ -138,7 +138,7 @@ mod tests {
|
|||
assert_eq!(results.create_data.id, "eppdev-contact-4".into());
|
||||
assert_eq!(
|
||||
results.create_data.created_at,
|
||||
Utc.ymd(2021, 7, 25).and_hms(16, 5, 32)
|
||||
Utc.with_ymd_and_hms(2021, 7, 25, 16, 5, 32).unwrap(),
|
||||
);
|
||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||
|
|
|
@ -161,7 +161,7 @@ mod tests {
|
|||
assert_eq!(result.info_data.creator_id, "SYSTEM".into());
|
||||
assert_eq!(
|
||||
result.info_data.created_at,
|
||||
Utc.ymd(2021, 7, 23).and_hms(13, 9, 9)
|
||||
Utc.with_ymd_and_hms(2021, 7, 23, 13, 9, 9).unwrap(),
|
||||
);
|
||||
assert_eq!(
|
||||
*(result.info_data.updater_id.as_ref().unwrap()),
|
||||
|
@ -169,7 +169,7 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
result.info_data.updated_at,
|
||||
Some(Utc.ymd(2021, 7, 23).and_hms(13, 9, 9))
|
||||
Utc.with_ymd_and_hms(2021, 7, 23, 13, 9, 9).single()
|
||||
);
|
||||
assert_eq!((*auth_info).password, "eppdev-387323".into());
|
||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||
|
|
|
@ -226,11 +226,11 @@ mod tests {
|
|||
assert_eq!(result.create_data.name, "eppdev-2.com".into());
|
||||
assert_eq!(
|
||||
result.create_data.created_at,
|
||||
Utc.ymd(2021, 7, 25).and_hms(18, 11, 35)
|
||||
Utc.with_ymd_and_hms(2021, 7, 25, 18, 11, 35).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
*result.create_data.expiring_at.as_ref().unwrap(),
|
||||
Utc.ymd(2022, 7, 25).and_hms(18, 11, 34)
|
||||
Utc.with_ymd_and_hms(2022, 7, 25, 18, 11, 34).unwrap()
|
||||
);
|
||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||
|
|
|
@ -180,7 +180,7 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
*result.info_data.created_at.as_ref().unwrap(),
|
||||
Utc.ymd(2021, 7, 23).and_hms(15, 31, 20)
|
||||
Utc.with_ymd_and_hms(2021, 7, 23, 15, 31, 20).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
*result.info_data.updater_id.as_ref().unwrap(),
|
||||
|
@ -188,11 +188,11 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
*result.info_data.updated_at.as_ref().unwrap(),
|
||||
Utc.ymd(2021, 7, 23).and_hms(15, 31, 21)
|
||||
Utc.with_ymd_and_hms(2021, 7, 23, 15, 31, 21).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
*result.info_data.expiring_at.as_ref().unwrap(),
|
||||
Utc.ymd(2023, 7, 23).and_hms(15, 31, 20)
|
||||
Utc.with_ymd_and_hms(2023, 7, 23, 15, 31, 20).unwrap()
|
||||
);
|
||||
assert_eq!((*auth_info).password, "epP4uthd#v".into());
|
||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||
|
|
|
@ -85,7 +85,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn command() {
|
||||
let exp_date = NaiveDate::from_ymd(2022, 7, 23);
|
||||
let exp_date = NaiveDate::from_ymd_opt(2022, 7, 23).unwrap();
|
||||
let object = DomainRenew::new("eppdev.com", exp_date, Period::years(1).unwrap());
|
||||
assert_serialized("request/domain/renew.xml", &object);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ mod tests {
|
|||
assert_eq!(result.renew_data.name, "eppdev-1.com".into());
|
||||
assert_eq!(
|
||||
*result.renew_data.expiring_at.as_ref().unwrap(),
|
||||
Utc.ymd(2024, 7, 23).and_hms(15, 31, 20)
|
||||
Utc.with_ymd_and_hms(2024, 7, 23, 15, 31, 20).unwrap()
|
||||
);
|
||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||
|
|
|
@ -189,16 +189,16 @@ mod tests {
|
|||
assert_eq!(result.transfer_data.requester_id, "eppdev".into());
|
||||
assert_eq!(
|
||||
result.transfer_data.requested_at,
|
||||
Utc.ymd(2021, 7, 23).and_hms(15, 31, 21),
|
||||
Utc.with_ymd_and_hms(2021, 7, 23, 15, 31, 21).unwrap(),
|
||||
);
|
||||
assert_eq!(result.transfer_data.ack_id, "ClientY".into());
|
||||
assert_eq!(
|
||||
result.transfer_data.ack_by,
|
||||
Utc.ymd(2021, 7, 28).and_hms(15, 31, 21)
|
||||
Utc.with_ymd_and_hms(2021, 7, 28, 15, 31, 21).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
result.transfer_data.expiring_at,
|
||||
Some(Utc.ymd(2022, 7, 2).and_hms(14, 53, 19)),
|
||||
Utc.with_ymd_and_hms(2022, 7, 2, 14, 53, 19).single(),
|
||||
);
|
||||
assert_eq!(*object.tr_ids.client_tr_id.as_ref().unwrap(), CLTRID.into());
|
||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||
|
@ -247,16 +247,16 @@ mod tests {
|
|||
assert_eq!(result.transfer_data.requester_id, "eppdev".into());
|
||||
assert_eq!(
|
||||
result.transfer_data.requested_at,
|
||||
Utc.ymd(2021, 7, 23).and_hms(15, 31, 21)
|
||||
Utc.with_ymd_and_hms(2021, 7, 23, 15, 31, 21).unwrap()
|
||||
);
|
||||
assert_eq!(result.transfer_data.ack_id, "ClientY".into());
|
||||
assert_eq!(
|
||||
result.transfer_data.ack_by,
|
||||
Utc.ymd(2021, 7, 28).and_hms(15, 31, 21)
|
||||
Utc.with_ymd_and_hms(2021, 7, 28, 15, 31, 21).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
result.transfer_data.expiring_at,
|
||||
Some(Utc.ymd(2022, 7, 2).and_hms(14, 53, 19))
|
||||
Utc.with_ymd_and_hms(2022, 7, 2, 14, 53, 19).single()
|
||||
);
|
||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||
|
|
|
@ -323,7 +323,7 @@ mod tests {
|
|||
assert_eq!(object.data.service_id, "ISPAPI EPP Server");
|
||||
assert_eq!(
|
||||
object.data.service_date,
|
||||
Utc.ymd(2021, 7, 25).and_hms(14, 51, 17)
|
||||
Utc.with_ymd_and_hms(2021, 7, 25, 14, 51, 17).unwrap()
|
||||
);
|
||||
assert_eq!(object.data.svc_menu.options.version, "1.0".into());
|
||||
assert_eq!(object.data.svc_menu.options.lang, "en".into());
|
||||
|
|
|
@ -101,7 +101,7 @@ mod tests {
|
|||
assert_eq!(result.create_data.name, "host2.eppdev-1.com".into());
|
||||
assert_eq!(
|
||||
result.create_data.created_at,
|
||||
Utc.ymd(2021, 7, 26).and_hms(5, 28, 55)
|
||||
Utc.with_ymd_and_hms(2021, 7, 26, 5, 28, 55).unwrap()
|
||||
);
|
||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||
|
|
|
@ -140,7 +140,7 @@ mod tests {
|
|||
assert_eq!(result.info_data.creator_id, "creator".into());
|
||||
assert_eq!(
|
||||
result.info_data.created_at,
|
||||
Utc.ymd(2021, 7, 26).and_hms(5, 28, 55)
|
||||
Utc.with_ymd_and_hms(2021, 7, 26, 5, 28, 55).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
*(result.info_data.updater_id.as_ref().unwrap()),
|
||||
|
@ -148,7 +148,7 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
result.info_data.updated_at,
|
||||
Some(Utc.ymd(2021, 7, 26).and_hms(5, 28, 55))
|
||||
Utc.with_ymd_and_hms(2021, 7, 26, 5, 28, 55).single()
|
||||
);
|
||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||
|
|
|
@ -80,7 +80,10 @@ mod tests {
|
|||
);
|
||||
assert_eq!(msg.count, 5);
|
||||
assert_eq!(msg.id, "12345".to_string());
|
||||
assert_eq!(msg.date, Some(Utc.ymd(2021, 7, 23).and_hms(19, 12, 43)));
|
||||
assert_eq!(
|
||||
msg.date,
|
||||
Utc.with_ymd_and_hms(2021, 7, 23, 19, 12, 43).single()
|
||||
);
|
||||
assert_eq!(
|
||||
*(msg.message.as_ref().unwrap()),
|
||||
"Transfer requested.".into()
|
||||
|
@ -90,12 +93,18 @@ mod tests {
|
|||
assert_eq!(tr.name, "eppdev-transfer.com".into());
|
||||
assert_eq!(tr.transfer_status, "pending".into());
|
||||
assert_eq!(tr.requester_id, "eppdev".into());
|
||||
assert_eq!(tr.requested_at, Utc.ymd(2021, 7, 23).and_hms(15, 31, 21));
|
||||
assert_eq!(
|
||||
tr.requested_at,
|
||||
Utc.with_ymd_and_hms(2021, 7, 23, 15, 31, 21).unwrap()
|
||||
);
|
||||
assert_eq!(tr.ack_id, "ClientY".into());
|
||||
assert_eq!(tr.ack_by, Utc.ymd(2021, 7, 28).and_hms(15, 31, 21));
|
||||
assert_eq!(
|
||||
tr.ack_by,
|
||||
Utc.with_ymd_and_hms(2021, 7, 28, 15, 31, 21).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
tr.expiring_at,
|
||||
Some(Utc.ymd(2022, 7, 2).and_hms(14, 53, 19))
|
||||
Utc.with_ymd_and_hms(2022, 7, 2, 14, 53, 19).single()
|
||||
);
|
||||
} else {
|
||||
panic!("Wrong type");
|
||||
|
@ -121,7 +130,10 @@ mod tests {
|
|||
);
|
||||
assert_eq!(msg.count, 4);
|
||||
assert_eq!(msg.id, "12345".to_string());
|
||||
assert_eq!(msg.date, Some(Utc.ymd(2022, 1, 2).and_hms(11, 30, 45)));
|
||||
assert_eq!(
|
||||
msg.date,
|
||||
Utc.with_ymd_and_hms(2022, 1, 2, 11, 30, 45).single()
|
||||
);
|
||||
assert_eq!(
|
||||
*(msg.message.as_ref().unwrap()),
|
||||
"Unused objects policy".into()
|
||||
|
@ -138,11 +150,14 @@ mod tests {
|
|||
.any(|a| a == &IpAddr::from([1, 1, 1, 1])));
|
||||
assert_eq!(host.client_id, "1234".into());
|
||||
assert_eq!(host.creator_id, "user".into());
|
||||
assert_eq!(host.created_at, Utc.ymd(2021, 12, 1).and_hms(22, 40, 48));
|
||||
assert_eq!(
|
||||
host.created_at,
|
||||
Utc.with_ymd_and_hms(2021, 12, 1, 22, 40, 48).unwrap()
|
||||
);
|
||||
assert_eq!(host.updater_id, Some("user".into()));
|
||||
assert_eq!(
|
||||
host.updated_at,
|
||||
Some(Utc.ymd(2021, 12, 1).and_hms(22, 40, 48))
|
||||
Utc.with_ymd_and_hms(2021, 12, 1, 22, 40, 48).single()
|
||||
);
|
||||
} else {
|
||||
panic!("Wrong type");
|
||||
|
@ -168,7 +183,10 @@ mod tests {
|
|||
|
||||
assert_eq!(msg.count, 4);
|
||||
assert_eq!(msg.id, "12346".to_string());
|
||||
assert_eq!(msg.date, Some(Utc.ymd(2000, 6, 8).and_hms(22, 10, 0)));
|
||||
assert_eq!(
|
||||
msg.date,
|
||||
Utc.with_ymd_and_hms(2000, 6, 8, 22, 10, 0).single()
|
||||
);
|
||||
assert_eq!(
|
||||
*(msg.message.as_ref().unwrap()),
|
||||
"Credit balance low.".into()
|
||||
|
|
Loading…
Reference in New Issue