rgp:infData should allow multiple rgp:rgpStatus

This commit is contained in:
Nicholas Rempel 2021-12-03 10:43:07 -08:00 committed by masalachai
parent 5261a733be
commit 26579600d0
4 changed files with 59 additions and 3 deletions

View File

@ -98,7 +98,7 @@ impl Options {
#[serde(rename = "extension")] #[serde(rename = "extension")]
pub struct Extension<E: ElementName> { pub struct Extension<E: ElementName> {
/// Data under the &lt;extension&gt; tag /// Data under the &lt;extension&gt; tag
#[serde(alias = "upData", alias = "namestoreExt")] #[serde(alias = "upData", alias = "namestoreExt", alias = "infData")]
pub data: E, pub data: E,
} }

View File

@ -125,5 +125,5 @@ pub struct RgpRequestResponse {
xmlns: String, xmlns: String,
/// Data under the &lt;rgpStatus&gt; tag /// Data under the &lt;rgpStatus&gt; tag
#[serde(rename = "rgpStatus")] #[serde(rename = "rgpStatus")]
pub rgp_status: RgpStatus, pub rgp_status: Vec<RgpStatus>,
} }

View File

@ -643,10 +643,21 @@ mod response {
assert_eq!(object.result.code, 1000); assert_eq!(object.result.code, 1000);
assert_eq!(object.result.message, SUCCESS_MSG.into()); assert_eq!(object.result.message, SUCCESS_MSG.into());
assert_eq!(ext.data.rgp_status.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());
} }
#[test]
fn rgp_restore_domain_info_response() {
let xml = get_xml("response/extensions/domain_info_rgp.xml").unwrap();
let object = DomainInfo::<RgpRestoreRequest>::deserialize_response(xml.as_str()).unwrap();
let ext = object.extension.unwrap();
assert_eq!(ext.data.rgp_status[0].status, "addPeriod");
assert_eq!(ext.data.rgp_status[1].status, "renewPeriod");
}
#[test] #[test]
fn namestore() { fn namestore() {
let xml = get_xml("response/extensions/namestore.xml").unwrap(); let xml = get_xml("response/extensions/namestore.xml").unwrap();

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<domain:infData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<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:ns>
<domain:hostObj>ns1.eppdev-1.com</domain:hostObj>
<domain:hostObj>ns2.eppdev-1.com</domain:hostObj>
</domain:ns>
<domain:host>ns1.eppdev-1.com</domain:host>
<domain:host>ns2.eppdev-1.com</domain:host>
<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>
<extension>
<rgp:infData xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0">
<rgp:rgpStatus s="addPeriod">endDate=2021-12-07T19:08:08Z</rgp:rgpStatus>
<rgp:rgpStatus s="renewPeriod">endDate=2021-12-07T23:07:49Z</rgp:rgpStatus>
</rgp:infData>
</extension>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>