diff options
author | Kim Alvefur <zash@zash.se> | 2019-11-25 20:52:03 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-11-25 20:52:03 +0100 |
commit | cb1ec1605974c11ab431aa2537804956f1ecd579 (patch) | |
tree | ea506547a702c0dd195ef7c2e35289054ba52b79 /spec | |
parent | 7954f16d5913ce2383e220c040e36b153ac522e3 (diff) | |
download | prosody-cb1ec1605974c11ab431aa2537804956f1ecd579.tar.gz prosody-cb1ec1605974c11ab431aa2537804956f1ecd579.zip |
util.stanza: Check that argument to error_reply is NOT a stanza of type error
Replying to an error is Very Bad
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_stanza_spec.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua index 23cdbeb9..04458303 100644 --- a/spec/util_stanza_spec.lua +++ b/spec/util_stanza_spec.lua @@ -220,6 +220,16 @@ describe("util.stanza", function() st.error_reply(not "a stanza", "modify", "bad-request"); end, "expected stanza"); end); + + it("should reject stanzas of type error", function () + assert.has.error_match(function () + st.error_reply(st.message({type="error"}), "cancel", "conflict"); + end, "got stanza of type error"); + assert.has.error_match(function () + st.error_reply(st.error_reply(st.message({type="chat"}), "modify", "forbidden"), "cancel", "service-unavailable"); + end, "got stanza of type error"); + end); + end); describe("should reject #invalid", function () |