Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub struct All;

/// Type corresponding to `<none>` in the EPP greeting XML
#[derive(Debug, Eq, FromXml, PartialEq)]
#[xml(rename = "noAccess", ns(EPP_XMLNS))]
#[xml(rename = "none", ns(EPP_XMLNS))]
pub struct NoAccess;

/// Type corresponding to `<null>` in the EPP greeting XML
Expand Down Expand Up @@ -348,4 +348,29 @@ mod tests {
ExpiryType::Relative(Relative("P1M".into()))
);
}

#[test]
fn greeting_no_access() {
let xml = get_xml("response/greeting_dcp_none.xml").unwrap();
let object = xml::deserialize::<Greeting>(xml.as_str()).unwrap();

assert_eq!(object.service_id, "ISPAPI EPP Server");
assert_eq!(
object.service_date,
Utc.with_ymd_and_hms(2021, 7, 25, 14, 51, 17).unwrap()
);
assert_eq!(object.svc_menu.options.version, "1.0");
assert_eq!(object.svc_menu.options.lang, "en");
assert_eq!(object.svc_menu.services.obj_uris.len(), 4);
assert_eq!(object.svc_menu.services.svc_ext.unwrap().ext_uris.len(), 5);
assert_eq!(object.dcp.statement.len(), 2);
assert!(matches!(
object.dcp.access.inner,
super::AccessType::NoAccess(_)
));
assert_eq!(
object.dcp.expiry.unwrap().inner,
ExpiryType::Relative(Relative("P1M".into()))
);
}
}
54 changes: 54 additions & 0 deletions tests/resources/response/greeting_dcp_none.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<greeting>
<svID>ISPAPI EPP Server</svID>
<svDate>2021-07-25T14:51:17.0Z</svDate>
<svcMenu>
<version>1.0</version>
<lang>en</lang>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
<objURI>http://schema.ispapi.net/epp/xml/keyvalue-1.0</objURI>
<svcExtension>
<extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
<extURI>urn:ietf:params:xml:ns:secDNS-1.0</extURI>
<extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
<extURI>urn:ietf:params:xml:ns:fee-0.7</extURI>
<extURI>http://schema.ispapi.net/epp/xml/keyvalue-1.0</extURI>
</svcExtension>
</svcMenu>
<dcp>
<access>
<none />
</access>
<statement>
<purpose>
<admin />
<prov />
</purpose>
<recipient>
<ours />
<public />
</recipient>
<retention>
<stated />
</retention>
</statement>
<statement>
<purpose>
<other />
</purpose>
<recipient>
<unrelated />
</recipient>
<retention>
<none />
</retention>
</statement>
<expiry>
<relative>P1M</relative>
</expiry>
</dcp>
</greeting>
</epp>
Loading