Add serialization test for pubsub publish-options and options element
This commit is contained in:
parent
8010b5a1e5
commit
6b14b593d3
2 changed files with 36 additions and 13 deletions
|
|
@ -403,13 +403,13 @@ mod tests {
|
||||||
|
|
||||||
let form = DataForm::try_from(elem).unwrap();
|
let form = DataForm::try_from(elem).unwrap();
|
||||||
|
|
||||||
let foo = Query {
|
let query = Query {
|
||||||
queryid: None,
|
queryid: None,
|
||||||
node: None,
|
node: None,
|
||||||
set: None,
|
set: None,
|
||||||
form: Some(form),
|
form: Some(form),
|
||||||
};
|
};
|
||||||
let serialized: Element = foo.into();
|
let serialized: Element = query.into();
|
||||||
assert_eq!(serialized, reference);
|
assert_eq!(serialized, reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -519,6 +519,8 @@ impl From<PubSub> for Element {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::data_forms::{DataForm, DataFormType, Field, FieldType};
|
use crate::data_forms::{DataForm, DataFormType, Field, FieldType};
|
||||||
|
use jid::FullJid;
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create() {
|
fn create() {
|
||||||
|
|
@ -690,23 +692,44 @@ mod tests {
|
||||||
assert_eq!(subscribe_options2.required, true);
|
assert_eq!(subscribe_options2.required, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_serialize_configure() {
|
|
||||||
assert!(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_serialize_options() {
|
fn test_serialize_options() {
|
||||||
assert!(false);
|
let reference: Element = "<options xmlns='http://jabber.org/protocol/pubsub' jid='juliet@capulet.lit/balcony'><x xmlns='jabber:x:data' type='submit'/></options>"
|
||||||
|
.parse()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let elem: Element = "<x xmlns='jabber:x:data' type='submit'/>"
|
||||||
|
.parse()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let form = DataForm::try_from(elem).unwrap();
|
||||||
|
|
||||||
|
let options = Options {
|
||||||
|
jid: Jid::Full(FullJid::from_str("juliet@capulet.lit/balcony").unwrap()),
|
||||||
|
node: None,
|
||||||
|
subid: None,
|
||||||
|
form: Some(form),
|
||||||
|
};
|
||||||
|
let serialized: Element = options.into();
|
||||||
|
assert_eq!(serialized, reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_serialize_publish_options() {
|
fn test_serialize_publish_options() {
|
||||||
assert!(false);
|
let reference: Element = "<publish-options xmlns='http://jabber.org/protocol/pubsub'><x xmlns='jabber:x:data' type='submit'/></publish-options>"
|
||||||
}
|
.parse()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
#[test]
|
let elem: Element = "<x xmlns='jabber:x:data' type='submit'/>"
|
||||||
fn test_serialize_subscriptions() {
|
.parse()
|
||||||
assert!(false);
|
.unwrap();
|
||||||
|
|
||||||
|
let form = DataForm::try_from(elem).unwrap();
|
||||||
|
|
||||||
|
let options = PublishOptions {
|
||||||
|
form: Some(form),
|
||||||
|
};
|
||||||
|
let serialized: Element = options.into();
|
||||||
|
assert_eq!(serialized, reference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue