From c224133382ea45f2ea778dde3825a7f70732e0a4 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Tue, 21 Jan 2020 20:06:10 +0140 Subject: [PATCH] Add test for openpgp pubkey serialization --- xmpp-parsers/src/openpgp.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/xmpp-parsers/src/openpgp.rs b/xmpp-parsers/src/openpgp.rs index 6ee88cc..b862e3f 100644 --- a/xmpp-parsers/src/openpgp.rs +++ b/xmpp-parsers/src/openpgp.rs @@ -63,6 +63,7 @@ mod tests { pubsub::{Item as PubSubItem, Publish}, Item, NodeName, }; + use crate::Element; use std::str::FromStr; #[test] @@ -101,6 +102,18 @@ mod tests { #[test] fn test_serialize_pubkey() { - assert!(false); + let reference: Element = "AAAA" + .parse() + .unwrap(); + + let pubkey = PubKey { + date: None, + data: PubKeyData { + data: b"\0\0\0".to_vec(), + }, + }; + + let serialized: Element = pubkey.into(); + assert_eq!(serialized, reference); } }