aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_stanza_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-09-26 18:09:10 +0200
committerKim Alvefur <zash@zash.se>2020-09-26 18:09:10 +0200
commita2ec5e4e52adc58ef83d5e20f268f2a1005b13ac (patch)
treedee52ffe239a67fec2c369374320904f2cbfbf1f /spec/util_stanza_spec.lua
parent40800ea93bb1dca78c3548de58a09f424f5eef30 (diff)
downloadprosody-a2ec5e4e52adc58ef83d5e20f268f2a1005b13ac.tar.gz
prosody-a2ec5e4e52adc58ef83d5e20f268f2a1005b13ac.zip
util.stanza: Support Application-Specific Conditions in util.error
Diffstat (limited to 'spec/util_stanza_spec.lua')
-rw-r--r--spec/util_stanza_spec.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua
index cc32bba9..ba90eb84 100644
--- a/spec/util_stanza_spec.lua
+++ b/spec/util_stanza_spec.lua
@@ -252,8 +252,20 @@ describe("util.stanza", function()
local gonner = st.error_reply(s, gone);
assert.are.equal("gone", gonner.tags[1].tags[1].name);
assert.are.equal("file:///dev/null", gonner.tags[1].tags[1][1]);
- end);
+ local e = errors.new({ condition = "internal-server-error", text = "Namespaced thing happened",
+ extra = {namespace="xmpp:example.test", condition="this-happened"} })
+ local r = st.error_reply(s, e);
+ assert.are.equal("xmpp:example.test", r.tags[1].tags[3].attr.xmlns);
+ assert.are.equal("this-happened", r.tags[1].tags[3].name);
+
+ local e2 = errors.new({ condition = "internal-server-error", text = "Namespaced thing happened",
+ extra = {tag=st.stanza("that-happened", { xmlns = "xmpp:example.test", ["another-attribute"] = "here" })} })
+ local r2 = st.error_reply(s, e2);
+ assert.are.equal("xmpp:example.test", r2.tags[1].tags[3].attr.xmlns);
+ assert.are.equal("that-happened", r2.tags[1].tags[3].name);
+ assert.are.equal("here", r2.tags[1].tags[3].attr["another-attribute"]);
+ end);
end);
describe("should reject #invalid", function ()