From f3a18711e6ab1815d3495e0db4ec2e26687d3114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 22 Nov 2019 17:31:25 +0100 Subject: [PATCH] parsers/mam: add ignored failing test for serialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add failing test for #20. Thanks Paul. Now that needs fixing.. Signed-off-by: Maxime “pep” Buquet --- xmpp-parsers/src/mam.rs | 46 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/xmpp-parsers/src/mam.rs b/xmpp-parsers/src/mam.rs index 1f6bc5f..d1a67a3 100644 --- a/xmpp-parsers/src/mam.rs +++ b/xmpp-parsers/src/mam.rs @@ -193,6 +193,7 @@ impl From for Element { #[cfg(test)] mod tests { use super::*; + use crate::data_forms::{DataFormType, Field, FieldType}; use std::str::FromStr; #[cfg(target_pointer_width = "32")] @@ -378,7 +379,7 @@ mod tests { } #[test] - fn test_serialise() { + fn test_serialise_empty() { let elem: Element = "".parse().unwrap(); let replace = Query { queryid: None, @@ -389,4 +390,47 @@ mod tests { let elem2 = replace.into(); assert_eq!(elem, elem2); } + + #[ignore] + #[test] + fn test_serialize_query_with() { + let elem: Element = r#" + + + + urn:xmpp:mam:2 + + + juliet@capulet.lit + + + + "# + .parse() + .unwrap(); + + let form = DataForm { + type_: DataFormType::Submit, + form_type: Some(String::from(ns::MAM)), + title: None, + instructions: None, + fields: vec![Field { + var: String::from("var"), + type_: FieldType::TextSingle, + label: None, + required: true, + options: vec![], + values: vec![String::from("juliet@capulet.lit")], + media: vec![], + }], + }; + let foo = Query { + queryid: None, + node: None, + set: None, + form: Some(form), + }; + let elem2 = foo.into(); + assert_eq!(elem, elem2); + } }