From 1432807f110b0310e5a3c44a249c9e5c49511070 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Tue, 21 Jan 2020 19:52:56 +0140 Subject: [PATCH] Add tests for cert management serialization --- xmpp-parsers/src/cert_management.rs | 55 ++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/xmpp-parsers/src/cert_management.rs b/xmpp-parsers/src/cert_management.rs index 9478b020..d93ebb37 100644 --- a/xmpp-parsers/src/cert_management.rs +++ b/xmpp-parsers/src/cert_management.rs @@ -230,21 +230,68 @@ mod tests { #[test] fn test_serialize_item() { - assert!(false); + let reference: Element = "Mobile ClientAAAA" + .parse() + .unwrap(); + + let item = Item { + name: Name::from_str("Mobile Client").unwrap(), + cert: Cert { + data: b"\0\0\0".to_vec(), + }, + no_cert_management: false, + users: None, + }; + + let serialized: Element = item.into(); + assert_eq!(serialized, reference); } #[test] fn test_serialize_append() { - assert!(false); + let reference: Element = "Mobile ClientAAAA" + .parse() + .unwrap(); + + let append = Append { + name: Name::from_str("Mobile Client").unwrap(), + cert: Cert { + data: b"\0\0\0".to_vec(), + }, + no_cert_management: false, + }; + + let serialized: Element = append.into(); + assert_eq!(serialized, reference); } #[test] fn test_serialize_disable() { - assert!(false); + let reference: Element = + "Mobile Client" + .parse() + .unwrap(); + + let disable = Disable { + name: Name::from_str("Mobile Client").unwrap(), + }; + + let serialized: Element = disable.into(); + assert_eq!(serialized, reference); } #[test] fn test_serialize_revoke() { - assert!(false); + let reference: Element = + "Mobile Client" + .parse() + .unwrap(); + + let revoke = Revoke { + name: Name::from_str("Mobile Client").unwrap(), + }; + + let serialized: Element = revoke.into(); + assert_eq!(serialized, reference); } }