mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Add serialization test for carbons forwarded elemt
This commit is contained in:
parent
0d879eb231
commit
5da5795286
1 changed files with 30 additions and 2 deletions
|
@ -127,11 +127,39 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_serialize_received() {
|
||||
assert!(false);
|
||||
let reference: Element = "<received xmlns='urn:xmpp:carbons:2'><forwarded xmlns='urn:xmpp:forward:0'><message xmlns='jabber:client' to='juliet@capulet.example/balcony' from='romeo@montague.example/home'/></forwarded></received>"
|
||||
.parse()
|
||||
.unwrap();
|
||||
|
||||
let elem: Element = "<forwarded xmlns='urn:xmpp:forward:0'><message xmlns='jabber:client' to='juliet@capulet.example/balcony' from='romeo@montague.example/home'/></forwarded>"
|
||||
.parse()
|
||||
.unwrap();
|
||||
let forwarded = Forwarded::try_from(elem).unwrap();
|
||||
|
||||
let received = Received {
|
||||
forwarded: forwarded,
|
||||
};
|
||||
|
||||
let serialized: Element = received.into();
|
||||
assert_eq!(serialized, reference);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialize_sent() {
|
||||
assert!(false);
|
||||
let reference: Element = "<sent xmlns='urn:xmpp:carbons:2'><forwarded xmlns='urn:xmpp:forward:0'><message xmlns='jabber:client' to='juliet@capulet.example/balcony' from='romeo@montague.example/home'/></forwarded></sent>"
|
||||
.parse()
|
||||
.unwrap();
|
||||
|
||||
let elem: Element = "<forwarded xmlns='urn:xmpp:forward:0'><message xmlns='jabber:client' to='juliet@capulet.example/balcony' from='romeo@montague.example/home'/></forwarded>"
|
||||
.parse()
|
||||
.unwrap();
|
||||
let forwarded = Forwarded::try_from(elem).unwrap();
|
||||
|
||||
let sent = Sent {
|
||||
forwarded: forwarded,
|
||||
};
|
||||
|
||||
let serialized: Element = sent.into();
|
||||
assert_eq!(serialized, reference);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue