aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_util_stanza.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-07-14 13:41:02 +0200
committerKim Alvefur <zash@zash.se>2016-07-14 13:41:02 +0200
commitccadcc9b4710fcf04c51d01cb40611efd5f7b835 (patch)
tree7f1c0c36f5c9dadc79cbec11d668ba0bdef0d36f /tests/test_util_stanza.lua
parent3616de36510d613e3eb2e75e730f5066bfa41741 (diff)
parent81dba787f4875f51e6d376231373600401c99411 (diff)
downloadprosody-ccadcc9b4710fcf04c51d01cb40611efd5f7b835.tar.gz
prosody-ccadcc9b4710fcf04c51d01cb40611efd5f7b835.zip
Merge 0.10->trunk
Diffstat (limited to 'tests/test_util_stanza.lua')
-rw-r--r--tests/test_util_stanza.lua122
1 files changed, 66 insertions, 56 deletions
diff --git a/tests/test_util_stanza.lua b/tests/test_util_stanza.lua
index e5c96425..bc0ac64a 100644
--- a/tests/test_util_stanza.lua
+++ b/tests/test_util_stanza.lua
@@ -80,63 +80,73 @@ function presence(presence)
end
function reply(reply, _M)
- -- Test stanza
- local s = _M.stanza("s", { to = "touser", from = "fromuser", id = "123" })
- :tag("child1");
- -- Make reply stanza
- local r = reply(s);
- assert_equal(r.name, s.name);
- assert_equal(r.id, s.id);
- assert_equal(r.attr.to, s.attr.from);
- assert_equal(r.attr.from, s.attr.to);
- assert_equal(#r.tags, 0, "A reply should not include children of the original stanza");
-
- -- Test stanza
- local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" })
- :tag("child1");
- -- Make reply stanza
- local r = reply(s);
- assert_equal(r.name, s.name);
- assert_equal(r.id, s.id);
- assert_equal(r.attr.to, s.attr.from);
- assert_equal(r.attr.from, s.attr.to);
- assert_equal(r.attr.type, "result");
- assert_equal(#r.tags, 0, "A reply should not include children of the original stanza");
-
- -- Test stanza
- local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "set" })
- :tag("child1");
- -- Make reply stanza
- local r = reply(s);
- assert_equal(r.name, s.name);
- assert_equal(r.id, s.id);
- assert_equal(r.attr.to, s.attr.from);
- assert_equal(r.attr.from, s.attr.to);
- assert_equal(r.attr.type, "result");
- assert_equal(#r.tags, 0, "A reply should not include children of the original stanza");
+ do
+ -- Test stanza
+ local s = _M.stanza("s", { to = "touser", from = "fromuser", id = "123" })
+ :tag("child1");
+ -- Make reply stanza
+ local r = reply(s);
+ assert_equal(r.name, s.name);
+ assert_equal(r.id, s.id);
+ assert_equal(r.attr.to, s.attr.from);
+ assert_equal(r.attr.from, s.attr.to);
+ assert_equal(#r.tags, 0, "A reply should not include children of the original stanza");
+ end
+
+ do
+ -- Test stanza
+ local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" })
+ :tag("child1");
+ -- Make reply stanza
+ local r = reply(s);
+ assert_equal(r.name, s.name);
+ assert_equal(r.id, s.id);
+ assert_equal(r.attr.to, s.attr.from);
+ assert_equal(r.attr.from, s.attr.to);
+ assert_equal(r.attr.type, "result");
+ assert_equal(#r.tags, 0, "A reply should not include children of the original stanza");
+ end
+
+ do
+ -- Test stanza
+ local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "set" })
+ :tag("child1");
+ -- Make reply stanza
+ local r = reply(s);
+ assert_equal(r.name, s.name);
+ assert_equal(r.id, s.id);
+ assert_equal(r.attr.to, s.attr.from);
+ assert_equal(r.attr.from, s.attr.to);
+ assert_equal(r.attr.type, "result");
+ assert_equal(#r.tags, 0, "A reply should not include children of the original stanza");
+ end
end
function error_reply(error_reply, _M)
- -- Test stanza
- local s = _M.stanza("s", { to = "touser", from = "fromuser", id = "123" })
- :tag("child1");
- -- Make reply stanza
- local r = error_reply(s);
- assert_equal(r.name, s.name);
- assert_equal(r.id, s.id);
- assert_equal(r.attr.to, s.attr.from);
- assert_equal(r.attr.from, s.attr.to);
- assert_equal(#r.tags, 1);
-
- -- Test stanza
- local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" })
- :tag("child1");
- -- Make reply stanza
- local r = error_reply(s);
- assert_equal(r.name, s.name);
- assert_equal(r.id, s.id);
- assert_equal(r.attr.to, s.attr.from);
- assert_equal(r.attr.from, s.attr.to);
- assert_equal(r.attr.type, "error");
- assert_equal(#r.tags, 1);
+ do
+ -- Test stanza
+ local s = _M.stanza("s", { to = "touser", from = "fromuser", id = "123" })
+ :tag("child1");
+ -- Make reply stanza
+ local r = error_reply(s);
+ assert_equal(r.name, s.name);
+ assert_equal(r.id, s.id);
+ assert_equal(r.attr.to, s.attr.from);
+ assert_equal(r.attr.from, s.attr.to);
+ assert_equal(#r.tags, 1);
+ end
+
+ do
+ -- Test stanza
+ local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" })
+ :tag("child1");
+ -- Make reply stanza
+ local r = error_reply(s);
+ assert_equal(r.name, s.name);
+ assert_equal(r.id, s.id);
+ assert_equal(r.attr.to, s.attr.from);
+ assert_equal(r.attr.from, s.attr.to);
+ assert_equal(r.attr.type, "error");
+ assert_equal(#r.tags, 1);
+ end
end