Add serialization test for sm failed element

This commit is contained in:
Paul Fariello 2019-12-05 22:36:45 +01:00 committed by Paul Fariello
parent 6b14b593d3
commit 8d246975d7

View file

@ -227,6 +227,21 @@ mod tests {
#[test]
fn test_serialize_failed() {
assert!(false);
let reference: Element = "<failed xmlns='urn:xmpp:sm:3'><unexpected-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></failed>"
.parse()
.unwrap();
let elem: Element = "<unexpected-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
.parse()
.unwrap();
let error = DefinedCondition::try_from(elem).unwrap();
let failed = Failed {
h: None,
error: Some(error),
};
let serialized: Element = failed.into();
assert_eq!(serialized, reference);
}
}