diff --git a/epp-client/src/extensions/consolidate.rs b/epp-client/src/extensions/consolidate.rs index 5ea839d..629a2fc 100644 --- a/epp-client/src/extensions/consolidate.rs +++ b/epp-client/src/extensions/consolidate.rs @@ -61,12 +61,14 @@ impl fmt::Display for GMonthDay { /// ```no_run /// use std::collections::HashMap; /// -/// use epp_client::config::{EppClientConfig, EppClientConnection}; +/// use epp_client::config::{EppClientConfig, RegistryConfig}; /// use epp_client::EppClient; /// use epp_client::common::{DomainStatus, DomainContact}; -/// use epp_client::extensions::rgp::report::RgpRestoreReport; +/// use epp_client::extensions::consolidate::Sync; /// use epp_client::domain::update::DomainUpdate; /// use epp_client::generate_client_tr_id; +/// use epp_client::extensions::consolidate; +/// use epp_client::extensions::consolidate::GMonthDay; /// use epp_client::common::NoExtension; /// use chrono::{DateTime, NaiveDate}; /// use std::str::FromStr; @@ -74,10 +76,10 @@ impl fmt::Display for GMonthDay { /// #[tokio::main] /// async fn main() { /// // Create a config -/// let mut registry: HashMap = HashMap::new(); +/// let mut registry: HashMap = HashMap::new(); /// registry.insert( /// "registry_name".to_owned(), -/// EppClientConnection { +/// RegistryConfig { /// host: "example.com".to_owned(), /// port: 700, /// username: "username".to_owned(), @@ -94,18 +96,11 @@ impl fmt::Display for GMonthDay { /// Err(e) => panic!("Failed to create EppClient: {}", e) /// }; /// -/// let domain_restore_report = RgpRestoreReport::new( -/// pre_data, -/// post_data, -/// deleted_at, -/// restored_at, -/// restore_reason, -/// &statements, -/// other -/// ); +/// let exp = GMonthDay::new(5, 31, None).unwrap(); +/// let consolidate_ext = consolidate::Sync::new(exp); /// /// // Create an DomainUpdate instance -/// let mut domain_update = DomainUpdate::::new("eppdev-100.com").with_extension(domain_restore_report); +/// let mut domain_update = DomainUpdate::::new("eppdev-100.com").with_extension(consolidate_ext); /// /// // send it to the registry and receive a response of type EppDomainUpdateResponse /// let response = client.transact(domain_update, generate_client_tr_id(&client).as_str()).await.unwrap(); diff --git a/epp-client/src/tests/se.rs b/epp-client/src/tests/se.rs index b587795..47b6da8 100644 --- a/epp-client/src/tests/se.rs +++ b/epp-client/src/tests/se.rs @@ -29,6 +29,8 @@ mod request { use crate::domain::update::DomainAddRemove; use crate::domain::update::DomainChangeInfo; use crate::domain::update::DomainUpdate; + use crate::extensions::consolidate; + use crate::extensions::consolidate::GMonthDay; use crate::extensions::namestore::NameStore; use crate::extensions::rgp::report::RgpRestoreReport; use crate::extensions::rgp::request::RgpRestoreRequest; @@ -597,4 +599,25 @@ mod request { assert_eq!(xml, serialized); } + + #[test] + fn consolidate() { + let xml = get_xml("request/extensions/consolidate.xml").unwrap(); + + let exp = GMonthDay::new(5, 31, None).unwrap(); + + let consolidate_ext = consolidate::Sync::new(exp); + + let mut object = + DomainUpdate::::new("eppdev.com").with_extension(consolidate_ext); + + object.info(DomainChangeInfo { + registrant: None, + auth_info: None, + }); + + let serialized = object.serialize_request(CLTRID).unwrap(); + + assert_eq!(xml, serialized); + } } diff --git a/epp-client/test/resources/request/extensions/consolidate.xml b/epp-client/test/resources/request/extensions/consolidate.xml new file mode 100644 index 0000000..9cc0481 --- /dev/null +++ b/epp-client/test/resources/request/extensions/consolidate.xml @@ -0,0 +1,17 @@ + + + + + + eppdev.com + + + + + + --05-31 + + + cltrid:1626454866 + + \ No newline at end of file