Add test for openpgp pubkey serialization

This commit is contained in:
Paul Fariello 2020-01-21 20:06:10 +01:40 committed by Paul Fariello
parent 13afbfd099
commit c224133382

View file

@ -63,6 +63,7 @@ mod tests {
pubsub::{Item as PubSubItem, Publish}, pubsub::{Item as PubSubItem, Publish},
Item, NodeName, Item, NodeName,
}; };
use crate::Element;
use std::str::FromStr; use std::str::FromStr;
#[test] #[test]
@ -101,6 +102,18 @@ mod tests {
#[test] #[test]
fn test_serialize_pubkey() { fn test_serialize_pubkey() {
assert!(false); let reference: Element = "<pubkey xmlns='urn:xmpp:openpgp:0'><data>AAAA</data></pubkey>"
.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);
} }
} }