parsers/mam: add ignored failing test for serialization

Add failing test for #20. Thanks Paul.
Now that needs fixing..

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-11-22 17:31:25 +01:00
parent 141d11ad38
commit f3a18711e6
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -193,6 +193,7 @@ impl From<Prefs> 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 = "<query xmlns='urn:xmpp:mam:2'/>".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#"
<query xmlns='urn:xmpp:mam:2'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:mam:2</value>
</field>
<field var='with'>
<value>juliet@capulet.lit</value>
</field>
</x>
</query>
"#
.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);
}
}