1use std::fmt::Debug;
2
3use instant_xml::{FromXml, ToXml};
4
5use crate::{
6 common::{NoExtension, EPP_XMLNS},
7 request::{Command, Transaction},
8};
9
10impl Transaction<NoExtension> for Logout {}
11
12impl Command for Logout {
13 type Response = ();
14 const COMMAND: &'static str = "logout";
15}
16
17#[derive(Debug, Eq, FromXml, PartialEq, ToXml)]
18#[xml(rename = "logout", ns(EPP_XMLNS))]
20pub struct Logout;
21
22#[cfg(test)]
23mod tests {
24 use super::Logout;
25 use crate::response::ResultCode;
26 use crate::tests::{assert_serialized, response_from_file, CLTRID, SVTRID};
27
28 #[test]
29 fn command() {
30 let object = Logout;
31 assert_serialized("request/logout.xml", &object);
32 }
33
34 #[test]
35 fn response() {
36 let object = response_from_file::<Logout>("response/logout.xml");
37
38 assert_eq!(
39 object.result.code,
40 ResultCode::CommandCompletedSuccessfullyEndingSession
41 );
42 assert_eq!(
43 object.result.message,
44 "Command completed successfully; ending session"
45 );
46 assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID);
47 assert_eq!(object.tr_ids.server_tr_id, SVTRID);
48 }
49}