Add tests for namestore extension object

This commit is contained in:
Nicholas Rempel 2021-11-26 14:21:38 -08:00 committed by masalachai
parent 2e0165a839
commit 0a0e6ac9d5
4 changed files with 73 additions and 0 deletions

View File

@ -20,6 +20,7 @@ mod response {
use crate::domain::transfer::DomainTransferReject;
use crate::domain::transfer::DomainTransferRequest;
use crate::domain::update::DomainUpdate;
use crate::extensions::namestore::NameStore;
use crate::extensions::rgp::request::RgpRestoreRequest;
use crate::hello::ExpiryType;
use crate::hello::Greeting;
@ -645,4 +646,15 @@ mod response {
assert_eq!(ext.data.rgp_status.status, "pendingRestore".to_string());
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
}
#[test]
fn namestore() {
let xml = get_xml("response/extensions/namestore.xml").unwrap();
let object = DomainCheck::<NameStore>::deserialize_response(xml.as_str()).unwrap();
let ext = object.extension.unwrap();
assert_eq!(ext.data.subproduct, "com".into());
}
}

View File

@ -29,6 +29,7 @@ mod request {
use crate::domain::update::DomainAddRemove;
use crate::domain::update::DomainChangeInfo;
use crate::domain::update::DomainUpdate;
use crate::extensions::namestore::NameStore;
use crate::extensions::rgp::report::RgpRestoreReport;
use crate::extensions::rgp::request::RgpRestoreRequest;
use crate::hello::Hello;
@ -582,4 +583,19 @@ mod request {
assert_eq!(xml, serialized);
}
#[test]
fn namestore() {
let xml = get_xml("request/extensions/namestore.xml").unwrap();
let namestore_ext = NameStore::new("com");
let object =
DomainCheck::<NameStore>::new(vec!["example1.com", "example2.com", "example3.com"])
.with_extension(namestore_ext);
let serialized = object.serialize_request(CLTRID).unwrap();
assert_eq!(xml, serialized);
}
}

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">
<command>
<check>
<domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example1.com</domain:name>
<domain:name>example2.com</domain:name>
<domain:name>example3.com</domain:name>
</domain:check>
</check>
<extension>
<namestoreExt:namestoreExt xmlns:namestoreExt="http://www.verisign-grs.com/epp/namestoreExt-1.1">
<namestoreExt:subProduct>com</namestoreExt:subProduct>
</namestoreExt:namestoreExt>
</extension>
<clTRID>cltrid:1626454866</clTRID>
</command>
</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">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:cd>
<domain:name avail="1">eppdev.com</domain:name>
</domain:cd>
<domain:cd>
<domain:name avail="0">eppdev.net</domain:name>
</domain:cd>
</domain:chkData>
</resData>
<extension>
<namestoreExt:namestoreExt xmlns:namestoreExt="http://www.verisign-grs.com/epp/namestoreExt-1.1">
<namestoreExt:subProduct>com</namestoreExt:subProduct>
</namestoreExt:namestoreExt>
</extension>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>