Add test case for message only poll response

This commit is contained in:
Nicholas Rempel 2022-01-05 11:48:41 -08:00 committed by masalachai
parent 427db7a1eb
commit c0ebbf6b52
2 changed files with 47 additions and 0 deletions

View File

@ -149,6 +149,34 @@ mod tests {
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into()); assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
} }
#[test]
fn message_only_response() {
let xml = get_xml("response/message/poll_message_only.xml").unwrap();
let object = MessagePoll::deserialize_response(xml.as_str()).unwrap();
let msg = object.message_queue().unwrap();
assert_eq!(object.result.code, 1301);
assert_eq!(
object.result.message,
"Command completed successfully; ack to dequeue".into()
);
assert_eq!(msg.count, 4);
assert_eq!(msg.id, "12346".to_string());
assert_eq!(
*(msg.date.as_ref().unwrap()),
"2000-06-08T22:10:00.0Z".into()
);
assert_eq!(
*(msg.message.as_ref().unwrap()),
"Credit balance low.".into()
);
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
}
#[test] #[test]
fn empty_queue_response() { fn empty_queue_response() {
let xml = get_xml("response/message/poll_empty_queue.xml").unwrap(); let xml = get_xml("response/message/poll_empty_queue.xml").unwrap();

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<response>
<result code="1301">
<msg>Command completed successfully; ack to dequeue</msg>
</result>
<msgQ count="4" id="12346">
<qDate>2000-06-08T22:10:00.0Z</qDate>
<msg lang="en">Credit balance low.
<limit>100</limit>
<bal>5</bal>
</msg>
</msgQ>
<trID>
<clTRID>cltrid:1626454866</clTRID>
<svTRID>RO-6879-1627224678242975</svTRID>
</trID>
</response>
</epp>