aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-03-16 14:24:53 +0000
committerMatthew Wild <mwild1@gmail.com>2018-03-16 14:24:53 +0000
commitbbc5d5a638f4a52af1382ddd271e8414c5df126d (patch)
tree88877094f54da434d59b968c26f9436ec845b3db /spec
parenteb3a20eb05a2562881c2709f2a351f6292bc81d0 (diff)
downloadprosody-bbc5d5a638f4a52af1382ddd271e8414c5df126d.tar.gz
prosody-bbc5d5a638f4a52af1382ddd271e8414c5df126d.zip
util.stanza: Fix tests to call error_reply() correctly, and add tests to ensure it vaguely works
Diffstat (limited to 'spec')
-rw-r--r--spec/util_stanza_spec.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua
index be294e49..d8e4ba71 100644
--- a/spec/util_stanza_spec.lua
+++ b/spec/util_stanza_spec.lua
@@ -134,12 +134,13 @@ describe("util.stanza", function()
local s = st.stanza("s", { to = "touser", from = "fromuser", id = "123" })
:tag("child1");
-- Make reply stanza
- local r = st.error_reply(s);
+ local r = st.error_reply(s, "cancel", "service-unavailable");
assert.are.equal(r.name, s.name);
assert.are.equal(r.id, s.id);
assert.are.equal(r.attr.to, s.attr.from);
assert.are.equal(r.attr.from, s.attr.to);
assert.are.equal(#r.tags, 1);
+ assert.are.equal(r.tags[1].tags[1].name, "service-unavailable");
end);
it("should work for <iq get>", function()
@@ -147,13 +148,14 @@ describe("util.stanza", function()
local s = st.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" })
:tag("child1");
-- Make reply stanza
- local r = st.error_reply(s);
+ local r = st.error_reply(s, "cancel", "service-unavailable");
assert.are.equal(r.name, s.name);
assert.are.equal(r.id, s.id);
assert.are.equal(r.attr.to, s.attr.from);
assert.are.equal(r.attr.from, s.attr.to);
assert.are.equal(r.attr.type, "error");
assert.are.equal(#r.tags, 1);
+ assert.are.equal(r.tags[1].tags[1].name, "service-unavailable");
end);
end);
end);