Use an enum for result codes
This commit is contained in:
parent
630c6b06e4
commit
0c36d8add3
|
@ -89,6 +89,7 @@ mod tests {
|
||||||
use super::ContactCheck;
|
use super::ContactCheck;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -110,7 +111,7 @@ mod tests {
|
||||||
|
|
||||||
let results = object.res_data().unwrap();
|
let results = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
results.check_data.contact_list[0].contact.id,
|
results.check_data.contact_list[0].contact.id,
|
||||||
|
|
|
@ -101,6 +101,7 @@ mod tests {
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::contact::Address;
|
use crate::contact::Address;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -140,7 +141,7 @@ mod tests {
|
||||||
|
|
||||||
let results = object.res_data().unwrap();
|
let results = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(results.create_data.id, "eppdev-contact-4".into());
|
assert_eq!(results.create_data.id, "eppdev-contact-4".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
@ -47,6 +47,7 @@ mod tests {
|
||||||
use super::ContactDelete;
|
use super::ContactDelete;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -69,7 +70,7 @@ mod tests {
|
||||||
<ContactDelete as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
<ContactDelete as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
|
|
@ -105,6 +105,7 @@ mod tests {
|
||||||
use super::ContactInfo;
|
use super::ContactInfo;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -132,7 +133,7 @@ mod tests {
|
||||||
let fax_ext = fax.extension.as_ref().unwrap();
|
let fax_ext = fax.extension.as_ref().unwrap();
|
||||||
let auth_info = result.info_data.auth_info.as_ref().unwrap();
|
let auth_info = result.info_data.auth_info.as_ref().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.info_data.id, "eppdev-contact-3".into());
|
assert_eq!(result.info_data.id, "eppdev-contact-3".into());
|
||||||
assert_eq!(result.info_data.roid, "UNDEF-ROID".into());
|
assert_eq!(result.info_data.roid, "UNDEF-ROID".into());
|
||||||
|
|
|
@ -111,6 +111,7 @@ mod tests {
|
||||||
use crate::common::{NoExtension, ObjectStatus};
|
use crate::common::{NoExtension, ObjectStatus};
|
||||||
use crate::contact::Address;
|
use crate::contact::Address;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -148,7 +149,7 @@ mod tests {
|
||||||
<ContactUpdate as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
<ContactUpdate as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
|
|
@ -88,6 +88,7 @@ mod tests {
|
||||||
use super::DomainCheck;
|
use super::DomainCheck;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -111,7 +112,7 @@ mod tests {
|
||||||
|
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.check_data.domain_list[0].domain.name,
|
result.check_data.domain_list[0].domain.name,
|
||||||
|
|
|
@ -107,6 +107,7 @@ mod tests {
|
||||||
use crate::common::{HostAddr, NoExtension};
|
use crate::common::{HostAddr, NoExtension};
|
||||||
use crate::domain::{HostAttr, HostAttrList, HostObjList};
|
use crate::domain::{HostAttr, HostAttrList, HostObjList};
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -237,7 +238,7 @@ mod tests {
|
||||||
|
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.create_data.name, "eppdev-2.com".into());
|
assert_eq!(result.create_data.name, "eppdev-2.com".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
@ -47,6 +47,7 @@ mod tests {
|
||||||
use super::DomainDelete;
|
use super::DomainDelete;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -68,7 +69,7 @@ mod tests {
|
||||||
let object =
|
let object =
|
||||||
<DomainDelete as Transaction<NoExtension>>::deserialize_response(xml.as_str()).unwrap();
|
<DomainDelete as Transaction<NoExtension>>::deserialize_response(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
|
|
@ -133,6 +133,7 @@ mod tests {
|
||||||
use super::DomainInfo;
|
use super::DomainInfo;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -163,7 +164,7 @@ mod tests {
|
||||||
let registrant = result.info_data.registrant.as_ref().unwrap();
|
let registrant = result.info_data.registrant.as_ref().unwrap();
|
||||||
let contacts = result.info_data.contacts.as_ref().unwrap();
|
let contacts = result.info_data.contacts.as_ref().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.info_data.name, "eppdev-1.com".into());
|
assert_eq!(result.info_data.name, "eppdev-1.com".into());
|
||||||
assert_eq!(result.info_data.roid, "125899511_DOMAIN_COM-VRSN".into());
|
assert_eq!(result.info_data.roid, "125899511_DOMAIN_COM-VRSN".into());
|
||||||
|
|
|
@ -79,6 +79,7 @@ mod tests {
|
||||||
use super::DomainRenew;
|
use super::DomainRenew;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
|
|
||||||
|
@ -104,7 +105,7 @@ mod tests {
|
||||||
|
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.renew_data.name, "eppdev-1.com".into());
|
assert_eq!(result.renew_data.name, "eppdev-1.com".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
@ -134,6 +134,7 @@ mod tests {
|
||||||
use super::DomainTransfer;
|
use super::DomainTransfer;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -210,7 +211,10 @@ mod tests {
|
||||||
|
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1001);
|
assert_eq!(
|
||||||
|
object.result.code,
|
||||||
|
ResultCode::CommandCompletedSuccessfullyActionPending
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.result.message,
|
object.result.message,
|
||||||
"Command completed successfully; action pending".into()
|
"Command completed successfully; action pending".into()
|
||||||
|
@ -239,7 +243,7 @@ mod tests {
|
||||||
<DomainTransfer as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
<DomainTransfer as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
@ -252,7 +256,7 @@ mod tests {
|
||||||
<DomainTransfer as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
<DomainTransfer as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
@ -265,7 +269,7 @@ mod tests {
|
||||||
<DomainTransfer as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
<DomainTransfer as Transaction<NoExtension>>::deserialize_response(xml.as_str())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
@ -280,7 +284,7 @@ mod tests {
|
||||||
|
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.transfer_data.name, "eppdev-transfer.com".into());
|
assert_eq!(result.transfer_data.name, "eppdev-transfer.com".into());
|
||||||
assert_eq!(result.transfer_data.transfer_status, "pending".into());
|
assert_eq!(result.transfer_data.transfer_status, "pending".into());
|
||||||
|
|
|
@ -104,6 +104,7 @@ mod tests {
|
||||||
use super::{DomainAddRemove, DomainAuthInfo, DomainChangeInfo, DomainContact, DomainUpdate};
|
use super::{DomainAddRemove, DomainAuthInfo, DomainChangeInfo, DomainContact, DomainUpdate};
|
||||||
use crate::common::{NoExtension, ObjectStatus};
|
use crate::common::{NoExtension, ObjectStatus};
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -155,7 +156,7 @@ mod tests {
|
||||||
let object =
|
let object =
|
||||||
<DomainUpdate as Transaction<NoExtension>>::deserialize_response(xml.as_str()).unwrap();
|
<DomainUpdate as Transaction<NoExtension>>::deserialize_response(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
|
|
@ -71,6 +71,7 @@ mod tests {
|
||||||
use crate::domain::info::DomainInfo;
|
use crate::domain::info::DomainInfo;
|
||||||
use crate::domain::update::{DomainChangeInfo, DomainUpdate};
|
use crate::domain::update::{DomainChangeInfo, DomainUpdate};
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -112,7 +113,7 @@ mod tests {
|
||||||
|
|
||||||
let ext = object.extension.unwrap();
|
let ext = object.extension.unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(ext.data.rgp_status[0].status, "pendingRestore".to_string());
|
assert_eq!(ext.data.rgp_status[0].status, "pendingRestore".to_string());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
|
|
@ -92,6 +92,7 @@ mod tests {
|
||||||
use super::HostCheck;
|
use super::HostCheck;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -115,7 +116,7 @@ mod tests {
|
||||||
|
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.check_data.host_list[0].host.name,
|
result.check_data.host_list[0].host.name,
|
||||||
|
|
|
@ -73,6 +73,7 @@ mod tests {
|
||||||
use super::HostCreate;
|
use super::HostCreate;
|
||||||
use crate::common::{HostAddr, NoExtension};
|
use crate::common::{HostAddr, NoExtension};
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -101,7 +102,7 @@ mod tests {
|
||||||
|
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.create_data.name, "host2.eppdev-1.com".into());
|
assert_eq!(result.create_data.name, "host2.eppdev-1.com".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
@ -47,6 +47,7 @@ mod tests {
|
||||||
use super::HostDelete;
|
use super::HostDelete;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -68,7 +69,7 @@ mod tests {
|
||||||
let object =
|
let object =
|
||||||
<HostDelete as Transaction<NoExtension>>::deserialize_response(xml.as_str()).unwrap();
|
<HostDelete as Transaction<NoExtension>>::deserialize_response(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
|
|
@ -92,6 +92,7 @@ mod tests {
|
||||||
use super::HostInfo;
|
use super::HostInfo;
|
||||||
use crate::common::NoExtension;
|
use crate::common::NoExtension;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -115,7 +116,7 @@ mod tests {
|
||||||
|
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.info_data.name, "host2.eppdev-1.com".into());
|
assert_eq!(result.info_data.name, "host2.eppdev-1.com".into());
|
||||||
assert_eq!(result.info_data.roid, "UNDEF-ROID".into());
|
assert_eq!(result.info_data.roid, "UNDEF-ROID".into());
|
||||||
|
|
|
@ -93,6 +93,7 @@ mod tests {
|
||||||
use super::{HostAddRemove, HostChangeInfo, HostUpdate};
|
use super::{HostAddRemove, HostChangeInfo, HostUpdate};
|
||||||
use crate::common::{HostAddr, NoExtension, ObjectStatus};
|
use crate::common::{HostAddr, NoExtension, ObjectStatus};
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -136,7 +137,7 @@ mod tests {
|
||||||
let object =
|
let object =
|
||||||
<HostUpdate as Transaction<NoExtension>>::deserialize_response(xml.as_str()).unwrap();
|
<HostUpdate as Transaction<NoExtension>>::deserialize_response(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
|
|
@ -68,6 +68,7 @@ impl<'a> Command for Login<'a> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::Login;
|
use super::Login;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -86,7 +87,7 @@ mod tests {
|
||||||
let xml = get_xml("response/login.xml").unwrap();
|
let xml = get_xml("response/login.xml").unwrap();
|
||||||
let object = Login::deserialize_response(xml.as_str()).unwrap();
|
let object = Login::deserialize_response(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
|
||||||
|
|
|
@ -22,6 +22,7 @@ pub struct Logout;
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::Logout;
|
use super::Logout;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -38,7 +39,10 @@ mod tests {
|
||||||
let xml = get_xml("response/logout.xml").unwrap();
|
let xml = get_xml("response/logout.xml").unwrap();
|
||||||
let object = Logout::deserialize_response(xml.as_str()).unwrap();
|
let object = Logout::deserialize_response(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1500);
|
assert_eq!(
|
||||||
|
object.result.code,
|
||||||
|
ResultCode::CommandCompletedSuccessfullyEndingSession
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.result.message,
|
object.result.message,
|
||||||
"Command completed successfully; ending session".into()
|
"Command completed successfully; ending session".into()
|
||||||
|
|
|
@ -35,6 +35,7 @@ impl<'a> MessageAck<'a> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::MessageAck;
|
use super::MessageAck;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -55,7 +56,7 @@ mod tests {
|
||||||
|
|
||||||
let msg = object.message_queue().unwrap();
|
let msg = object.message_queue().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1000);
|
assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
assert_eq!(object.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(msg.count, 4);
|
assert_eq!(msg.count, 4);
|
||||||
assert_eq!(msg.id, "12345".to_string());
|
assert_eq!(msg.id, "12345".to_string());
|
||||||
|
|
|
@ -53,6 +53,7 @@ mod tests {
|
||||||
use super::MessagePoll;
|
use super::MessagePoll;
|
||||||
use crate::message::poll::MessageData;
|
use crate::message::poll::MessageData;
|
||||||
use crate::request::Transaction;
|
use crate::request::Transaction;
|
||||||
|
use crate::response::ResultCode;
|
||||||
use crate::tests::{get_xml, CLTRID, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SVTRID};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -74,7 +75,10 @@ mod tests {
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
let msg = object.message_queue().unwrap();
|
let msg = object.message_queue().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1301);
|
assert_eq!(
|
||||||
|
object.result.code,
|
||||||
|
ResultCode::CommandCompletedSuccessfullyAckToDequeue
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.result.message,
|
object.result.message,
|
||||||
"Command completed successfully; ack to dequeue".into()
|
"Command completed successfully; ack to dequeue".into()
|
||||||
|
@ -117,7 +121,10 @@ mod tests {
|
||||||
let result = object.res_data().unwrap();
|
let result = object.res_data().unwrap();
|
||||||
let msg = object.message_queue().unwrap();
|
let msg = object.message_queue().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1301);
|
assert_eq!(
|
||||||
|
object.result.code,
|
||||||
|
ResultCode::CommandCompletedSuccessfullyAckToDequeue
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.result.message,
|
object.result.message,
|
||||||
"Command completed successfully; ack to dequeue".into()
|
"Command completed successfully; ack to dequeue".into()
|
||||||
|
@ -156,7 +163,10 @@ mod tests {
|
||||||
|
|
||||||
let msg = object.message_queue().unwrap();
|
let msg = object.message_queue().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1301);
|
assert_eq!(
|
||||||
|
object.result.code,
|
||||||
|
ResultCode::CommandCompletedSuccessfullyAckToDequeue
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.result.message,
|
object.result.message,
|
||||||
"Command completed successfully; ack to dequeue".into()
|
"Command completed successfully; ack to dequeue".into()
|
||||||
|
@ -182,7 +192,10 @@ mod tests {
|
||||||
let xml = get_xml("response/message/poll_empty_queue.xml").unwrap();
|
let xml = get_xml("response/message/poll_empty_queue.xml").unwrap();
|
||||||
let object = MessagePoll::deserialize_response(xml.as_str()).unwrap();
|
let object = MessagePoll::deserialize_response(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.result.code, 1300);
|
assert_eq!(
|
||||||
|
object.result.code,
|
||||||
|
ResultCode::CommandCompletedSuccessfullyNoMessages
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.result.message,
|
object.result.message,
|
||||||
"Command completed successfully; no messages".into()
|
"Command completed successfully; no messages".into()
|
||||||
|
|
|
@ -33,9 +33,9 @@ pub trait Transaction<Ext: Extension>: Command + Sized {
|
||||||
) -> Result<Response<Self::Response, Ext::Response>, Error> {
|
) -> Result<Response<Self::Response, Ext::Response>, Error> {
|
||||||
let rsp =
|
let rsp =
|
||||||
<ResponseDocument<Self::Response, Ext::Response> as EppXml>::deserialize(epp_xml)?;
|
<ResponseDocument<Self::Response, Ext::Response> as EppXml>::deserialize(epp_xml)?;
|
||||||
match rsp.data.result.code {
|
match rsp.data.result.code.is_success() {
|
||||||
0..=2000 => Ok(rsp.data),
|
true => Ok(rsp.data),
|
||||||
_ => Err(crate::error::Error::Command(ResponseStatus {
|
false => Err(crate::error::Error::Command(ResponseStatus {
|
||||||
result: rsp.data.result,
|
result: rsp.data.result,
|
||||||
tr_ids: rsp.data.tr_ids,
|
tr_ids: rsp.data.tr_ids,
|
||||||
})),
|
})),
|
||||||
|
|
130
src/response.rs
130
src/response.rs
|
@ -1,7 +1,7 @@
|
||||||
//! Types for EPP responses
|
//! Types for EPP responses
|
||||||
|
|
||||||
use serde::{de::DeserializeOwned, Deserialize};
|
use serde::{de::DeserializeOwned, Deserialize};
|
||||||
use std::fmt::Debug;
|
use std::fmt::{self, Debug};
|
||||||
|
|
||||||
use crate::common::StringValue;
|
use crate::common::StringValue;
|
||||||
use crate::xml::EppXml;
|
use crate::xml::EppXml;
|
||||||
|
@ -33,7 +33,7 @@ pub struct ExtValue {
|
||||||
#[derive(Deserialize, Debug, PartialEq)]
|
#[derive(Deserialize, Debug, PartialEq)]
|
||||||
pub struct EppResult {
|
pub struct EppResult {
|
||||||
/// The result code
|
/// The result code
|
||||||
pub code: u16,
|
pub code: ResultCode,
|
||||||
/// The result message
|
/// The result message
|
||||||
#[serde(rename = "msg")]
|
#[serde(rename = "msg")]
|
||||||
pub message: StringValue<'static>,
|
pub message: StringValue<'static>,
|
||||||
|
@ -42,6 +42,128 @@ pub struct EppResult {
|
||||||
pub ext_value: Option<ExtValue>,
|
pub ext_value: Option<ExtValue>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Response codes as enumerated in section 3 of RFC 5730
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
pub enum ResultCode {
|
||||||
|
CommandCompletedSuccessfully = 1000,
|
||||||
|
CommandCompletedSuccessfullyActionPending = 1001,
|
||||||
|
CommandCompletedSuccessfullyNoMessages = 1300,
|
||||||
|
CommandCompletedSuccessfullyAckToDequeue = 1301,
|
||||||
|
CommandCompletedSuccessfullyEndingSession = 1500,
|
||||||
|
UnknownCommand = 2000,
|
||||||
|
CommandSyntaxError = 2001,
|
||||||
|
CommandUseError = 2002,
|
||||||
|
RequiredParameterMissing = 2003,
|
||||||
|
ParameterValueRangeError = 2004,
|
||||||
|
ParameterValueSyntaxError = 2005,
|
||||||
|
UnimplementedProtocolVersion = 2100,
|
||||||
|
UnimplementedCommand = 2101,
|
||||||
|
UnimplementedOption = 2102,
|
||||||
|
UnimplementedExtension = 2103,
|
||||||
|
BillingFailure = 2104,
|
||||||
|
ObjectIsNotEligibleForRenewal = 2105,
|
||||||
|
ObjectIsNotEligibleForTransfer = 2106,
|
||||||
|
AuthenticationError = 2200,
|
||||||
|
AuthorizationError = 2201,
|
||||||
|
InvalidAuthorizationInformation = 2202,
|
||||||
|
ObjectPendingTransfer = 2300,
|
||||||
|
ObjectNotPendingTransfer = 2301,
|
||||||
|
ObjectExists = 2302,
|
||||||
|
ObjectDoesNotExist = 2303,
|
||||||
|
ObjectStatusProhibitsOperation = 2304,
|
||||||
|
ObjectAssociationProhibitsOperation = 2305,
|
||||||
|
ParameterValuePolicyError = 2306,
|
||||||
|
UnimplementedObjectService = 2307,
|
||||||
|
DataManagementPolicyViolation = 2308,
|
||||||
|
CommandFailed = 2400,
|
||||||
|
CommandFailedServerClosingConnection = 2500,
|
||||||
|
AuthenticationErrorServerClosingConnection = 2501,
|
||||||
|
SessionLimitExceededServerClosingConnection = 2502,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ResultCode {
|
||||||
|
pub fn from_u16(code: u16) -> Option<Self> {
|
||||||
|
match code {
|
||||||
|
1000 => Some(ResultCode::CommandCompletedSuccessfully),
|
||||||
|
1001 => Some(ResultCode::CommandCompletedSuccessfullyActionPending),
|
||||||
|
1300 => Some(ResultCode::CommandCompletedSuccessfullyNoMessages),
|
||||||
|
1301 => Some(ResultCode::CommandCompletedSuccessfullyAckToDequeue),
|
||||||
|
1500 => Some(ResultCode::CommandCompletedSuccessfullyEndingSession),
|
||||||
|
2000 => Some(ResultCode::UnknownCommand),
|
||||||
|
2001 => Some(ResultCode::CommandSyntaxError),
|
||||||
|
2002 => Some(ResultCode::CommandUseError),
|
||||||
|
2003 => Some(ResultCode::RequiredParameterMissing),
|
||||||
|
2004 => Some(ResultCode::ParameterValueRangeError),
|
||||||
|
2005 => Some(ResultCode::ParameterValueSyntaxError),
|
||||||
|
2100 => Some(ResultCode::UnimplementedProtocolVersion),
|
||||||
|
2101 => Some(ResultCode::UnimplementedCommand),
|
||||||
|
2102 => Some(ResultCode::UnimplementedOption),
|
||||||
|
2103 => Some(ResultCode::UnimplementedExtension),
|
||||||
|
2104 => Some(ResultCode::BillingFailure),
|
||||||
|
2105 => Some(ResultCode::ObjectIsNotEligibleForRenewal),
|
||||||
|
2106 => Some(ResultCode::ObjectIsNotEligibleForTransfer),
|
||||||
|
2200 => Some(ResultCode::AuthenticationError),
|
||||||
|
2201 => Some(ResultCode::AuthorizationError),
|
||||||
|
2202 => Some(ResultCode::InvalidAuthorizationInformation),
|
||||||
|
2300 => Some(ResultCode::ObjectPendingTransfer),
|
||||||
|
2301 => Some(ResultCode::ObjectNotPendingTransfer),
|
||||||
|
2302 => Some(ResultCode::ObjectExists),
|
||||||
|
2303 => Some(ResultCode::ObjectDoesNotExist),
|
||||||
|
2304 => Some(ResultCode::ObjectStatusProhibitsOperation),
|
||||||
|
2305 => Some(ResultCode::ObjectAssociationProhibitsOperation),
|
||||||
|
2306 => Some(ResultCode::ParameterValuePolicyError),
|
||||||
|
2307 => Some(ResultCode::UnimplementedObjectService),
|
||||||
|
2308 => Some(ResultCode::DataManagementPolicyViolation),
|
||||||
|
2400 => Some(ResultCode::CommandFailed),
|
||||||
|
2500 => Some(ResultCode::CommandFailedServerClosingConnection),
|
||||||
|
2501 => Some(ResultCode::AuthenticationErrorServerClosingConnection),
|
||||||
|
2502 => Some(ResultCode::SessionLimitExceededServerClosingConnection),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_success(&self) -> bool {
|
||||||
|
use ResultCode::*;
|
||||||
|
matches!(
|
||||||
|
self,
|
||||||
|
CommandCompletedSuccessfully
|
||||||
|
| CommandCompletedSuccessfullyActionPending
|
||||||
|
| CommandCompletedSuccessfullyNoMessages
|
||||||
|
| CommandCompletedSuccessfullyAckToDequeue
|
||||||
|
| CommandCompletedSuccessfullyEndingSession
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de> Deserialize<'de> for ResultCode {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<ResultCode, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::de::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
deserializer.deserialize_u16(ResultCodeVisitor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ResultCodeVisitor;
|
||||||
|
|
||||||
|
impl<'de> serde::de::Visitor<'de> for ResultCodeVisitor {
|
||||||
|
type Value = ResultCode;
|
||||||
|
|
||||||
|
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
formatter.write_str("a valid EPP result code")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_u16<E>(self, v: u16) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: serde::de::Error,
|
||||||
|
{
|
||||||
|
use serde::de::Unexpected;
|
||||||
|
ResultCode::from_u16(v).ok_or_else(|| {
|
||||||
|
E::invalid_value(Unexpected::Unsigned(v as u64), &"unexpected result code")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Type corresponding to the <trID> tag in an EPP response XML
|
/// Type corresponding to the <trID> tag in an EPP response XML
|
||||||
#[derive(Deserialize, Debug, PartialEq)]
|
#[derive(Deserialize, Debug, PartialEq)]
|
||||||
pub struct ResponseTRID {
|
pub struct ResponseTRID {
|
||||||
|
@ -135,7 +257,7 @@ impl<T, E> Response<T, E> {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::ResultDocument;
|
use super::{ResultCode, ResultDocument};
|
||||||
use crate::tests::{get_xml, CLTRID, SVTRID};
|
use crate::tests::{get_xml, CLTRID, SVTRID};
|
||||||
use crate::xml::EppXml;
|
use crate::xml::EppXml;
|
||||||
|
|
||||||
|
@ -144,7 +266,7 @@ mod tests {
|
||||||
let xml = get_xml("response/error.xml").unwrap();
|
let xml = get_xml("response/error.xml").unwrap();
|
||||||
let object = ResultDocument::deserialize(xml.as_str()).unwrap();
|
let object = ResultDocument::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 2303);
|
assert_eq!(object.data.result.code, ResultCode::ObjectDoesNotExist);
|
||||||
assert_eq!(object.data.result.message, "Object does not exist".into());
|
assert_eq!(object.data.result.message, "Object does not exist".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.data.result.ext_value.unwrap().reason,
|
object.data.result.ext_value.unwrap().reason,
|
||||||
|
|
|
@ -7,6 +7,7 @@ use tokio_test::io::Builder;
|
||||||
|
|
||||||
use epp_client::domain::check::DomainCheck;
|
use epp_client::domain::check::DomainCheck;
|
||||||
use epp_client::login::Login;
|
use epp_client::login::Login;
|
||||||
|
use epp_client::response::ResultCode;
|
||||||
use epp_client::EppClient;
|
use epp_client::EppClient;
|
||||||
|
|
||||||
const CLTRID: &str = "cltrid:1626454866";
|
const CLTRID: &str = "cltrid:1626454866";
|
||||||
|
@ -103,7 +104,7 @@ async fn client() {
|
||||||
.transact(&DomainCheck::new(vec!["eppdev.com", "eppdev.net"]), CLTRID)
|
.transact(&DomainCheck::new(vec!["eppdev.com", "eppdev.net"]), CLTRID)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(rsp.result.code, 1000);
|
assert_eq!(rsp.result.code, ResultCode::CommandCompletedSuccessfully);
|
||||||
|
|
||||||
let result = rsp.res_data().unwrap();
|
let result = rsp.res_data().unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
Loading…
Reference in New Issue