added deserialization tests for all responses so far

This commit is contained in:
Ritesh Chitlangi 2021-07-26 15:05:53 +08:00
parent 263e30211c
commit 699b1e0f30
25 changed files with 760 additions and 29 deletions

View File

@ -150,7 +150,7 @@ async fn delete_domain(client: &mut EppClient) {
} }
async fn renew_domain(client: &mut EppClient) { async fn renew_domain(client: &mut EppClient) {
let exp_date = NaiveDate::from_ymd(2022, 7, 23); let exp_date = NaiveDate::from_ymd(2023, 7, 23);
let renew_domain = EppDomainRenew::new("eppdev-1.com", exp_date, 1, gen_client_tr_id("eppdev").unwrap().as_str()); let renew_domain = EppDomainRenew::new("eppdev-1.com", exp_date, 1, gen_client_tr_id("eppdev").unwrap().as_str());
@ -195,10 +195,10 @@ async fn check_hosts(client: &mut EppClient) {
async fn create_host(client: &mut EppClient) { async fn create_host(client: &mut EppClient) {
let host = Host { let host = Host {
name: "host1.eppdev-1.com".to_string_value(), name: "host2.eppdev-1.com".to_string_value(),
addresses: Some(vec![ addresses: Some(vec![
HostAddr::new("v4", "29.245.122.14"), HostAddr::new("v4", "29.245.122.14"),
HostAddr::new("v6", "2400:6180:100:d0::8d6:4001"), HostAddr::new("v6", "2404:6800:4001:801::200e"),
]) ])
}; };
@ -215,7 +215,7 @@ async fn query_host(client: &mut EppClient) {
async fn update_host(client: &mut EppClient) { async fn update_host(client: &mut EppClient) {
let addr = vec![ let addr = vec![
HostAddr::new("v6", "2400:6180:100:d0::8d6:4001"), HostAddr::new("v6", "2404:6800:4001:801::200e"),
]; ];
let add = HostAddRemove { let add = HostAddRemove {
@ -298,7 +298,7 @@ async fn main() {
// update_domain(&mut client).await; // update_domain(&mut client).await;
delete_domain(&mut client).await; // delete_domain(&mut client).await;
// renew_domain(&mut client).await; // renew_domain(&mut client).await;
@ -322,7 +322,7 @@ async fn main() {
// delete_host(&mut client).await; // delete_host(&mut client).await;
// poll_message(&mut client).await; poll_message(&mut client).await;
// ack_message(&mut client).await; // ack_message(&mut client).await;
} }

View File

@ -19,9 +19,9 @@ pub enum DomainNsList {
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct HostAddr { pub struct HostAddr {
#[serde(rename = "ip")] #[serde(rename = "ip")]
ip_version: Option<String>, pub ip_version: Option<String>,
#[serde(rename = "$value")] #[serde(rename = "$value")]
address: String, pub address: String,
} }
impl HostAddr { impl HostAddr {

View File

@ -158,9 +158,9 @@ pub struct MessageQueue {
pub count: u32, pub count: u32,
pub id: String, pub id: String,
#[serde(rename = "qDate")] #[serde(rename = "qDate")]
pub date: StringValue, pub date: Option<StringValue>,
#[serde(rename = "msg")] #[serde(rename = "msg")]
pub message: StringValue, pub message: Option<StringValue>,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)] #[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
@ -185,10 +185,16 @@ pub struct CommandResponseStatus {
} }
impl<T> CommandResponse<T> { impl<T> CommandResponse<T> {
pub fn results(&self) -> Option<&T> { pub fn res_data(&self) -> Option<&T> {
match &self.res_data { match &self.res_data {
Some(res_data) => Some(&res_data), Some(res_data) => Some(&res_data),
None => None, None => None,
} }
} }
pub fn message_queue(&self) -> Option<&MessageQueue> {
match &self.message_queue {
Some(queue) => Some(&queue),
None => None,
}
}
} }

View File

@ -28,7 +28,8 @@ pub struct DomainInfoData {
schema_location: String, schema_location: String,
pub name: StringValue, pub name: StringValue,
pub roid: StringValue, pub roid: StringValue,
pub status: Vec<DomainStatus>, #[serde(rename = "status")]
pub statuses: Vec<DomainStatus>,
pub registrant: StringValue, pub registrant: StringValue,
#[serde(rename = "contact")] #[serde(rename = "contact")]
pub contacts: Vec<DomainContact>, pub contacts: Vec<DomainContact>,
@ -49,7 +50,7 @@ pub struct DomainInfoData {
#[serde(rename = "trDate")] #[serde(rename = "trDate")]
pub transferred_at: Option<StringValue>, pub transferred_at: Option<StringValue>,
#[serde(rename = "authInfo")] #[serde(rename = "authInfo")]
pub auth_info: AuthInfo, pub auth_info: Option<AuthInfo>,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]

View File

@ -22,11 +22,11 @@ pub struct DomainTransferData {
#[serde(rename = "reID")] #[serde(rename = "reID")]
pub requester_id: StringValue, pub requester_id: StringValue,
#[serde(rename = "reDate")] #[serde(rename = "reDate")]
pub request_date: StringValue, pub requested_at: StringValue,
#[serde(rename = "acID")] #[serde(rename = "acID")]
pub responder_id: StringValue, pub ack_id: StringValue,
#[serde(rename = "acDate")] #[serde(rename = "acDate")]
pub respond_by_date: StringValue, pub ack_by: StringValue,
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
pub expiry_date: StringValue, pub expiry_date: StringValue,
} }

View File

@ -15,7 +15,8 @@ pub struct HostCheck {
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct HostCheckDataItem { pub struct HostCheckDataItem {
pub name: HostCheck, #[serde(rename = "name")]
pub host: HostCheck,
pub reason: Option<StringValue>, pub reason: Option<StringValue>,
} }

View File

@ -17,5 +17,5 @@ pub struct HostCreateData {
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct HostCreateResult { pub struct HostCreateResult {
#[serde(rename = "creData")] #[serde(rename = "creData")]
pub check_data: HostCreateData, pub create_data: HostCreateData,
} }

View File

@ -1,3 +1,4 @@
use crate::epp::response::EppCommandResponse; use crate::epp::object::EppObject;
use crate::epp::response::CommandResponse;
pub type EppMessageAckResponse = EppCommandResponse; pub type EppMessageAckResponse = EppObject<CommandResponse<String>>;

View File

@ -2,7 +2,7 @@ use crate::epp::object::{EppObject, StringValue};
use crate::epp::response::CommandResponse; use crate::epp::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
pub type EppMessagePollResponse = EppObject<CommandResponse<MessageDomainTransferData>>; pub type EppMessagePollResponse = EppObject<CommandResponse<MessagePollResult>>;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct MessageDomainTransferData { pub struct MessageDomainTransferData {
@ -14,11 +14,17 @@ pub struct MessageDomainTransferData {
#[serde(rename = "reID")] #[serde(rename = "reID")]
pub requester_id: StringValue, pub requester_id: StringValue,
#[serde(rename = "reDate")] #[serde(rename = "reDate")]
pub request_date: StringValue, pub requested_at: StringValue,
#[serde(rename = "acID")] #[serde(rename = "acID")]
pub responder_id: StringValue, pub ack_id: StringValue,
#[serde(rename = "acDate")] #[serde(rename = "acDate")]
pub respond_by_date: StringValue, pub ack_by: StringValue,
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
pub expiry_date: StringValue, pub expiry_date: StringValue,
} }
#[derive(Serialize, Deserialize, Debug)]
pub struct MessagePollResult {
#[serde(rename = "trnData")]
pub message_data: MessageDomainTransferData,
}

View File

@ -96,7 +96,7 @@ mod response {
let xml = get_xml("response/contact/check.xml").unwrap(); let xml = get_xml("response/contact/check.xml").unwrap();
let object = EppContactCheckResponse::deserialize(xml.as_str()).unwrap(); let object = EppContactCheckResponse::deserialize(xml.as_str()).unwrap();
let results = object.data.results().unwrap(); let results = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000); assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value()); assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
@ -122,7 +122,7 @@ mod response {
let xml = get_xml("response/contact/create.xml").unwrap(); let xml = get_xml("response/contact/create.xml").unwrap();
let object = EppContactCreateResponse::deserialize(xml.as_str()).unwrap(); let object = EppContactCreateResponse::deserialize(xml.as_str()).unwrap();
let results = object.data.results().unwrap(); let results = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000); assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value()); assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
@ -157,7 +157,7 @@ mod response {
let xml = get_xml("response/contact/info.xml").unwrap(); let xml = get_xml("response/contact/info.xml").unwrap();
let object = EppContactInfoResponse::deserialize(xml.as_str()).unwrap(); let object = EppContactInfoResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.results().unwrap(); let result = object.data.res_data().unwrap();
let fax = result.info_data.fax.as_ref().unwrap(); let fax = result.info_data.fax.as_ref().unwrap();
let voice_ext = result.info_data.voice.extension.as_ref().unwrap(); let voice_ext = result.info_data.voice.extension.as_ref().unwrap();
let fax_ext = fax.extension.as_ref().unwrap(); let fax_ext = fax.extension.as_ref().unwrap();
@ -250,7 +250,7 @@ mod response {
let xml = get_xml("response/domain/check.xml").unwrap(); let xml = get_xml("response/domain/check.xml").unwrap();
let object = EppDomainCheckResponse::deserialize(xml.as_str()).unwrap(); let object = EppDomainCheckResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.results().unwrap(); let result = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000); assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value()); assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
@ -276,7 +276,7 @@ mod response {
let xml = get_xml("response/domain/create.xml").unwrap(); let xml = get_xml("response/domain/create.xml").unwrap();
let object = EppDomainCreateResponse::deserialize(xml.as_str()).unwrap(); let object = EppDomainCreateResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.results().unwrap(); let result = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000); assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value()); assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
@ -309,4 +309,433 @@ mod response {
); );
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value()); assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
} }
#[test]
fn domain_info() {
let xml = get_xml("response/domain/info.xml").unwrap();
let object = EppDomainInfoResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.res_data().unwrap();
let auth_info = result.info_data.auth_info.as_ref().unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(result.info_data.name, "eppdev-1.com".to_string_value());
assert_eq!(
result.info_data.roid,
"125899511_DOMAIN_COM-VRSN".to_string_value()
);
assert_eq!(result.info_data.statuses[0].status, "ok".to_string());
assert_eq!(
result.info_data.statuses[1].status,
"clientTransferProhibited".to_string()
);
assert_eq!(
result.info_data.registrant,
"eppdev-contact-2".to_string_value()
);
assert_eq!(
result.info_data.contacts[0].id,
"eppdev-contact-2".to_string()
);
assert_eq!(
result.info_data.contacts[0].contact_type,
"admin".to_string()
);
assert_eq!(
result.info_data.contacts[1].id,
"eppdev-contact-2".to_string()
);
assert_eq!(
result.info_data.contacts[1].contact_type,
"tech".to_string()
);
assert_eq!(
result.info_data.contacts[2].id,
"eppdev-contact-2".to_string()
);
assert_eq!(
result.info_data.contacts[2].contact_type,
"billing".to_string()
);
assert_eq!(result.info_data.client_id, "eppdev".to_string_value());
assert_eq!(result.info_data.creator_id, "SYSTEM".to_string_value());
assert_eq!(
result.info_data.created_at,
"2021-07-23T15:31:20.0Z".to_string_value()
);
assert_eq!(result.info_data.updater_id, "SYSTEM".to_string_value());
assert_eq!(
result.info_data.updated_at,
"2021-07-23T15:31:21.0Z".to_string_value()
);
assert_eq!(
result.info_data.expiry_date,
"2023-07-23T15:31:20.0Z".to_string_value()
);
assert_eq!((*auth_info).password, "epP4uthd#v".to_string_value());
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn domain_renew() {
let xml = get_xml("response/domain/renew.xml").unwrap();
let object = EppDomainRenewResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(result.renew_data.name, "eppdev-1.com".to_string_value());
assert_eq!(
result.renew_data.expiry_date,
"2024-07-23T15:31:20.0Z".to_string_value()
);
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn domain_transfer_request() {
let xml = get_xml("response/domain/transfer_request.xml").unwrap();
let object = EppDomainTransferRequestResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1001);
assert_eq!(
object.data.result.message,
"Command completed successfully; action pending".to_string_value()
);
assert_eq!(
result.transfer_data.name,
"eppdev-transfer.com".to_string_value()
);
assert_eq!(
result.transfer_data.transfer_status,
"pending".to_string_value()
);
assert_eq!(
result.transfer_data.requester_id,
"eppdev".to_string_value()
);
assert_eq!(
result.transfer_data.requested_at,
"2021-07-23T15:31:21.0Z".to_string_value()
);
assert_eq!(result.transfer_data.ack_id, "ClientY".to_string_value());
assert_eq!(
result.transfer_data.ack_by,
"2021-07-28T15:31:21.0Z".to_string_value()
);
assert_eq!(
result.transfer_data.expiry_date,
"2022-07-02T14:53:19.0Z".to_string_value()
);
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn domain_transfer_approve() {
let xml = get_xml("response/domain/transfer_approve.xml").unwrap();
let object = EppDomainTransferApproveResponse::deserialize(xml.as_str()).unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn domain_transfer_reject() {
let xml = get_xml("response/domain/transfer_reject.xml").unwrap();
let object = EppDomainTransferRejectResponse::deserialize(xml.as_str()).unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn domain_transfer_cancel() {
let xml = get_xml("response/domain/transfer_cancel.xml").unwrap();
let object = EppDomainTransferCancelResponse::deserialize(xml.as_str()).unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn domain_transfer_query() {
let xml = get_xml("response/domain/transfer_query.xml").unwrap();
let object = EppDomainTransferQueryResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
result.transfer_data.name,
"eppdev-transfer.com".to_string_value()
);
assert_eq!(
result.transfer_data.transfer_status,
"pending".to_string_value()
);
assert_eq!(
result.transfer_data.requester_id,
"eppdev".to_string_value()
);
assert_eq!(
result.transfer_data.requested_at,
"2021-07-23T15:31:21.0Z".to_string_value()
);
assert_eq!(result.transfer_data.ack_id, "ClientY".to_string_value());
assert_eq!(
result.transfer_data.ack_by,
"2021-07-28T15:31:21.0Z".to_string_value()
);
assert_eq!(
result.transfer_data.expiry_date,
"2022-07-02T14:53:19.0Z".to_string_value()
);
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn domain_update() {
let xml = get_xml("response/domain/update.xml").unwrap();
let object = EppDomainUpdateResponse::deserialize(xml.as_str()).unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn host_check() {
let xml = get_xml("response/host/check.xml").unwrap();
let object = EppHostCheckResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
result.check_data.host_list[0].host.name,
"host1.eppdev-1.com".to_string_value()
);
assert_eq!(result.check_data.host_list[0].host.available, 1);
assert_eq!(
result.check_data.host_list[1].host.name,
"ns1.testing.com".to_string_value()
);
assert_eq!(result.check_data.host_list[1].host.available, 0);
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn host_create() {
let xml = get_xml("response/host/create.xml").unwrap();
let object = EppHostCreateResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
result.create_data.name,
"host2.eppdev-1.com".to_string_value()
);
assert_eq!(
result.create_data.created_at,
"2021-07-26T05:28:55.0Z".to_string_value()
);
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn host_info() {
let xml = get_xml("response/host/info.xml").unwrap();
let object = EppHostInfoResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.res_data().unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
result.info_data.name,
"host2.eppdev-1.com".to_string_value()
);
assert_eq!(result.info_data.roid, "UNDEF-ROID".to_string_value());
assert_eq!(result.info_data.statuses[0].status, "ok".to_string());
assert_eq!(
*(result.info_data.addresses[0].ip_version.as_ref().unwrap()),
"v4".to_string()
);
assert_eq!(
result.info_data.addresses[0].address,
"29.245.122.14".to_string()
);
assert_eq!(
*(result.info_data.addresses[1].ip_version.as_ref().unwrap()),
"v6".to_string()
);
assert_eq!(
result.info_data.addresses[1].address,
"2404:6800:4001:0801:0000:0000:0000:200e".to_string()
);
assert_eq!(result.info_data.client_id, "eppdev".to_string_value());
assert_eq!(result.info_data.creator_id, "creator".to_string_value());
assert_eq!(
result.info_data.created_at,
"2021-07-26T05:28:55.0Z".to_string_value()
);
assert_eq!(
*(result.info_data.updater_id.as_ref().unwrap()),
"creator".to_string_value()
);
assert_eq!(
*(result.info_data.updated_at.as_ref().unwrap()),
"2021-07-26T05:28:55.0Z".to_string_value()
);
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn host_update() {
let xml = get_xml("response/host/update.xml").unwrap();
let object = EppHostUpdateResponse::deserialize(xml.as_str()).unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn host_delete() {
let xml = get_xml("response/host/delete.xml").unwrap();
let object = EppHostDeleteResponse::deserialize(xml.as_str()).unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn message_poll() {
let xml = get_xml("response/message/poll.xml").unwrap();
let object = EppMessagePollResponse::deserialize(xml.as_str()).unwrap();
let result = object.data.res_data().unwrap();
let msg = object.data.message_queue().unwrap();
assert_eq!(object.data.result.code, 1301);
assert_eq!(
object.data.result.message,
"Command completed successfully; ack to dequeue".to_string_value()
);
assert_eq!(msg.count, 5);
assert_eq!(msg.id, "12345".to_string());
assert_eq!(
*(msg.date.as_ref().unwrap()),
"2021-07-23T19:12:43.0Z".to_string_value()
);
assert_eq!(
*(msg.message.as_ref().unwrap()),
"Transfer requested.".to_string_value()
);
assert_eq!(
result.message_data.name,
"eppdev-transfer.com".to_string_value()
);
assert_eq!(
result.message_data.transfer_status,
"pending".to_string_value()
);
assert_eq!(result.message_data.requester_id, "eppdev".to_string_value());
assert_eq!(
result.message_data.requested_at,
"2021-07-23T15:31:21.0Z".to_string_value()
);
assert_eq!(result.message_data.ack_id, "ClientY".to_string_value());
assert_eq!(
result.message_data.ack_by,
"2021-07-28T15:31:21.0Z".to_string_value()
);
assert_eq!(
result.message_data.expiry_date,
"2022-07-02T14:53:19.0Z".to_string_value()
);
assert_eq!(
object.data.tr_ids.client_tr_id.unwrap(),
CLTRID.to_string_value()
);
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
#[test]
fn message_ack() {
let xml = get_xml("response/message/ack.xml").unwrap();
let object = EppMessageAckResponse::deserialize(xml.as_str()).unwrap();
let msg = object.data.message_queue().unwrap();
assert_eq!(object.data.result.code, 1000);
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
assert_eq!(msg.count, 4);
assert_eq!(msg.id, "12345".to_string());
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
}
} }

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<domain:infData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>eppdev-1.com</domain:name>
<domain:roid>125899511_DOMAIN_COM-VRSN</domain:roid>
<domain:status s="ok"/>
<domain:status s="clientTransferProhibited"/>
<domain:registrant>eppdev-contact-2</domain:registrant>
<domain:contact type="admin">eppdev-contact-2</domain:contact>
<domain:contact type="tech">eppdev-contact-2</domain:contact>
<domain:contact type="billing">eppdev-contact-2</domain:contact>
<domain:clID>eppdev</domain:clID>
<domain:crID>SYSTEM</domain:crID>
<domain:crDate>2021-07-23T15:31:20.0Z</domain:crDate>
<domain:upID>SYSTEM</domain:upID>
<domain:upDate>2021-07-23T15:31:21.0Z</domain:upDate>
<domain:exDate>2023-07-23T15:31:20.0Z</domain:exDate>
<domain:authInfo>
<domain:pw>epP4uthd#v</domain:pw>
</domain:authInfo>
</domain:infData>
</resData>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
<extValue>
<value xmlns:epp="urn:ietf:params:xml:ns:epp-1.0">
<epp:undef/>
</value>
<reason>200 Command completed successfully</reason>
</extValue>
</result>
<resData>
<domain:renData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>eppdev-1.com</domain:name>
<domain:exDate>2024-07-23T15:31:20.0Z</domain:exDate>
</domain:renData>
</resData>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<domain:trnData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>eppdev-transfer.com</domain:name>
<domain:trStatus>pending</domain:trStatus>
<domain:reID>eppdev</domain:reID>
<domain:reDate>2021-07-23T15:31:21.0Z</domain:reDate>
<domain:acID>ClientY</domain:acID>
<domain:acDate>2021-07-28T15:31:21.0Z</domain:acDate>
<domain:exDate>2022-07-02T14:53:19.0Z</domain:exDate>
</domain:trnData>
</resData>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1001">
<msg>Command completed successfully; action pending</msg>
</result>
<resData>
<domain:trnData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>eppdev-transfer.com</domain:name>
<domain:trStatus>pending</domain:trStatus>
<domain:reID>eppdev</domain:reID>
<domain:reDate>2021-07-23T15:31:21.0Z</domain:reDate>
<domain:acID>ClientY</domain:acID>
<domain:acDate>2021-07-28T15:31:21.0Z</domain:acDate>
<domain:exDate>2022-07-02T14:53:19.0Z</domain:exDate>
</domain:trnData>
</resData>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
<extValue>
<value xmlns:epp="urn:ietf:params:xml:ns:epp-1.0">
<epp:undef/>
</value>
<reason>200 Command completed successfully</reason>
</extValue>
</result>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<host:chkData xmlns:host="urn:ietf:params:xml:ns:host-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd">
<host:cd>
<host:name avail="1">host1.eppdev-1.com</host:name>
</host:cd>
<host:cd>
<host:name avail="0">ns1.testing.com</host:name>
</host:cd>
</host:chkData>
</resData>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<host:creData xmlns:host="urn:ietf:params:xml:ns:host-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd">
<host:name>host2.eppdev-1.com</host:name>
<host:crDate>2021-07-26T05:28:55.0Z</host:crDate>
</host:creData>
</resData>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<host:infData xmlns:host="urn:ietf:params:xml:ns:host-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd">
<host:name>host2.eppdev-1.com</host:name>
<host:roid>UNDEF-ROID</host:roid>
<host:status s="ok"/>
<host:addr ip="v4">29.245.122.14</host:addr>
<host:addr ip="v6">2404:6800:4001:0801:0000:0000:0000:200e</host:addr>
<host:clID>eppdev</host:clID>
<host:crID>creator</host:crID>
<host:crDate>2021-07-26T05:28:55.0Z</host:crDate>
<host:upID>creator</host:upID>
<host:upDate>2021-07-26T05:28:55.0Z</host:upDate>
</host:infData>
</resData>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<msgQ count="4" id="12345"/>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="1301">
<msg>Command completed successfully; ack to dequeue</msg>
</result>
<msgQ count="5" id="12345">
<qDate>2021-07-23T19:12:43.0Z</qDate>
<msg>Transfer requested.</msg>
</msgQ>
<resData>
<obj:trnData xmlns:obj="urn:ietf:params:xml:ns:obj-1.0">
<obj:name>eppdev-transfer.com</obj:name>
<obj:trStatus>pending</obj:trStatus>
<obj:reID>eppdev</obj:reID>
<obj:reDate>2021-07-23T15:31:21.0Z</obj:reDate>
<obj:acID>ClientY</obj:acID>
<obj:acDate>2021-07-28T15:31:21.0Z</obj:acDate>
<obj:exDate>2022-07-02T14:53:19.0Z</obj:exDate>
</obj:trnData>
</resData>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>