diff options
author | Kim Alvefur <zash@zash.se> | 2020-09-26 18:09:10 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-09-26 18:09:10 +0200 |
commit | 1c53f533b09008be2ed26e3ffccc31c2609cc566 (patch) | |
tree | dee52ffe239a67fec2c369374320904f2cbfbf1f /spec/util_stanza_spec.lua | |
parent | 8c0efc9e55d0980e2ce5872da325724aeaec5dba (diff) | |
download | prosody-1c53f533b09008be2ed26e3ffccc31c2609cc566.tar.gz prosody-1c53f533b09008be2ed26e3ffccc31c2609cc566.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.lua | 14 |
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 () |