From 13afbfd09927b27dc9ae147eb897f07583f5e991 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Tue, 21 Jan 2020 20:02:06 +0140 Subject: [PATCH] Add test for jingle udp transport serialization --- xmpp-parsers/src/jingle_ice_udp.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/xmpp-parsers/src/jingle_ice_udp.rs b/xmpp-parsers/src/jingle_ice_udp.rs index 72a18c7..d178e20 100644 --- a/xmpp-parsers/src/jingle_ice_udp.rs +++ b/xmpp-parsers/src/jingle_ice_udp.rs @@ -195,6 +195,24 @@ mod tests { #[test] fn test_serialize_transport() { - assert!(false); + let reference: Element = + "02:1A:CC:54:27:AB:EB:9C:53:3F:3E:4B:65:2E:7D:46:3F:54:42:CD:54:F1:7A:03:A2:7D:F9:B0:7F:46:19:B2" + .parse() + .unwrap(); + + let elem: Element = "02:1A:CC:54:27:AB:EB:9C:53:3F:3E:4B:65:2E:7D:46:3F:54:42:CD:54:F1:7A:03:A2:7D:F9:B0:7F:46:19:B2" + .parse() + .unwrap(); + let fingerprint = Fingerprint::try_from(elem).unwrap(); + + let transport = Transport { + pwd: None, + ufrag: None, + candidates: vec![], + fingerprint: Some(fingerprint), + }; + + let serialized: Element = transport.into(); + assert_eq!(serialized, reference); } }