From 6e84640f0d908fd4c0c6285352ff1a71edf6c263 Mon Sep 17 00:00:00 2001 From: Ritesh Chitlangi Date: Wed, 10 Nov 2021 04:00:36 +0800 Subject: [PATCH] fix deserialize test for contact info --- epp-client/src/epp/ext/neustar/object/data.rs | 3 --- epp-client/src/epp/ext/neustar/request/contact/create.rs | 3 +-- epp-client/src/epp/ext/neustar/request/contact/update.rs | 3 +-- epp-client/src/epp/ext/neustar/xml.rs | 2 -- epp-client/src/tests/ext/neustar/de.rs | 9 +++++++-- .../resources/ext/neustar/request/contact/create.xml | 2 +- .../resources/ext/neustar/request/contact/update.xml | 2 +- .../test/resources/ext/neustar/response/contact/info.xml | 2 +- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/epp-client/src/epp/ext/neustar/object/data.rs b/epp-client/src/epp/ext/neustar/object/data.rs index c6c5047..e7dd6cb 100644 --- a/epp-client/src/epp/ext/neustar/object/data.rs +++ b/epp-client/src/epp/ext/neustar/object/data.rs @@ -12,9 +12,6 @@ use std::fmt; pub struct Extension { /// The XML namespace for the Neustar <extension> tag pub xmlns: String, - /// XML schema location for the Neulevel extension - #[serde(rename = "xsi:schemaLocation")] - pub schema_location: String, /// The string under the <unspec> tag pub unspec: StringValue, } diff --git a/epp-client/src/epp/ext/neustar/request/contact/create.rs b/epp-client/src/epp/ext/neustar/request/contact/create.rs index e1dcc5e..72051c9 100644 --- a/epp-client/src/epp/ext/neustar/request/contact/create.rs +++ b/epp-client/src/epp/ext/neustar/request/contact/create.rs @@ -2,7 +2,7 @@ use crate::epp::ext::neustar::object::data::ContactExtension; use crate::epp::ext::neustar::object::data::Extension as NeustarExtension; -use crate::epp::ext::neustar::xml::{EPP_NEULEVEL_XMLNS, EPP_XSI_NEULEVEL_SCHEMA_LOCATION}; +use crate::epp::ext::neustar::xml::EPP_NEULEVEL_XMLNS; use crate::epp::object::data::{Phone, PostalInfo}; use crate::epp::object::{EppObject, Extension, StringValueTrait}; use crate::epp::request::contact::create::ContactCreate; @@ -77,7 +77,6 @@ impl EppNeustarContactCreate { let ext = NeustarExtension { xmlns: EPP_NEULEVEL_XMLNS.to_string(), - schema_location: EPP_XSI_NEULEVEL_SCHEMA_LOCATION.to_string(), unspec: extension.to_string().to_string_value(), }; diff --git a/epp-client/src/epp/ext/neustar/request/contact/update.rs b/epp-client/src/epp/ext/neustar/request/contact/update.rs index f166aa0..8796c68 100644 --- a/epp-client/src/epp/ext/neustar/request/contact/update.rs +++ b/epp-client/src/epp/ext/neustar/request/contact/update.rs @@ -2,7 +2,7 @@ use crate::epp::ext::neustar::object::data::ContactExtension; use crate::epp::ext::neustar::object::data::Extension as NeustarExtension; -use crate::epp::ext::neustar::xml::{EPP_NEULEVEL_XMLNS, EPP_XSI_NEULEVEL_SCHEMA_LOCATION}; +use crate::epp::ext::neustar::xml::EPP_NEULEVEL_XMLNS; use crate::epp::object::data::{ContactStatus, Phone, PostalInfo}; use crate::epp::object::{EppObject, Extension, StringValueTrait}; use crate::epp::request::contact::update::ContactUpdate; @@ -74,7 +74,6 @@ impl EppNeustarContactUpdate { self.data.extension = Some(Extension { data: NeustarExtension { xmlns: EPP_NEULEVEL_XMLNS.to_string(), - schema_location: EPP_XSI_NEULEVEL_SCHEMA_LOCATION.to_string(), unspec: extension.to_string().to_string_value(), }, }); diff --git a/epp-client/src/epp/ext/neustar/xml.rs b/epp-client/src/epp/ext/neustar/xml.rs index bbf7197..84049f4 100644 --- a/epp-client/src/epp/ext/neustar/xml.rs +++ b/epp-client/src/epp/ext/neustar/xml.rs @@ -1,5 +1,3 @@ //! Neustar specific EPP XML types and data pub const EPP_NEULEVEL_XMLNS: &str = "urn:ietf:params:xml:ns:neulevel-1.0"; -pub const EPP_XSI_NEULEVEL_SCHEMA_LOCATION: &str = - "urn:ietf:params:xml:ns:neulevel-1.0 neulevel-1.0.xsd"; diff --git a/epp-client/src/tests/ext/neustar/de.rs b/epp-client/src/tests/ext/neustar/de.rs index b79c5ef..c18aa46 100644 --- a/epp-client/src/tests/ext/neustar/de.rs +++ b/epp-client/src/tests/ext/neustar/de.rs @@ -12,13 +12,12 @@ mod response { let xml = get_xml("ext/neustar/response/contact/info.xml").unwrap(); let object = EppNeustarContactInfoResponse::deserialize(xml.as_str()).unwrap(); - println!("{:?}", object); - let result = object.data.res_data().unwrap(); let fax = result.info_data.fax.as_ref().unwrap(); let voice_ext = result.info_data.voice.extension.as_ref().unwrap(); let fax_ext = fax.extension.as_ref().unwrap(); let auth_info = result.info_data.auth_info.as_ref().unwrap(); + let ext = object.data.extension.as_ref().unwrap(); assert_eq!(object.data.result.code, 1000); assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value()); @@ -85,6 +84,12 @@ mod response { object.data.tr_ids.client_tr_id.unwrap(), CLTRID.to_string_value() ); + + assert_eq!( + (*ext).data.unspec, + "appPurpose=P2 nexusCategory=C31/DE".to_string_value() + ); + assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value()); } } diff --git a/epp-client/test/resources/ext/neustar/request/contact/create.xml b/epp-client/test/resources/ext/neustar/request/contact/create.xml index aa2d8a6..359851a 100644 --- a/epp-client/test/resources/ext/neustar/request/contact/create.xml +++ b/epp-client/test/resources/ext/neustar/request/contact/create.xml @@ -25,7 +25,7 @@ - + appPurpose=P2 nexusCategory=C31/DE diff --git a/epp-client/test/resources/ext/neustar/request/contact/update.xml b/epp-client/test/resources/ext/neustar/request/contact/update.xml index d447915..7bb70f9 100644 --- a/epp-client/test/resources/ext/neustar/request/contact/update.xml +++ b/epp-client/test/resources/ext/neustar/request/contact/update.xml @@ -32,7 +32,7 @@ - + nexusCategory=C31/DE diff --git a/epp-client/test/resources/ext/neustar/response/contact/info.xml b/epp-client/test/resources/ext/neustar/response/contact/info.xml index b521d3b..1271dc3 100644 --- a/epp-client/test/resources/ext/neustar/response/contact/info.xml +++ b/epp-client/test/resources/ext/neustar/response/contact/info.xml @@ -35,7 +35,7 @@ - + appPurpose=P2 nexusCategory=C31/DE