diff options
author | Kim Alvefur <zash@zash.se> | 2020-09-26 18:12:18 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-09-26 18:12:18 +0200 |
commit | 6674d10a2294a7f767fcdd0fbffe01060d522b32 (patch) | |
tree | 2515f16850c201f1fd077cd4fde322dc651f04aa /spec | |
parent | bdee3ae38c52eb1237dd05bc4237cf15689dba69 (diff) | |
download | prosody-6674d10a2294a7f767fcdd0fbffe01060d522b32.tar.gz prosody-6674d10a2294a7f767fcdd0fbffe01060d522b32.zip |
util.stanza: Extract Application-Specific Condition from errors
API change
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_stanza_spec.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua index a363086c..535f783b 100644 --- a/spec/util_stanza_spec.lua +++ b/spec/util_stanza_spec.lua @@ -276,6 +276,19 @@ describe("util.stanza", function() end); end); + describe("#get_error()", function () + describe("basics", function () + local s = st.message(); + local e = st.error_reply(s, "cancel", "not-acceptable", "UNACCEPTABLE!!!! ONE MILLION YEARS DUNGEON!") + :tag("dungeon", { xmlns = "urn:uuid:c9026187-5b05-4e70-b265-c3b6338a7d0f", period="1000000years"}); + local typ, cond, text, extra = e:get_error(); + assert.equal("cancel", typ); + assert.equal("not-acceptable", cond); + assert.equal("UNACCEPTABLE!!!! ONE MILLION YEARS DUNGEON!", text); + assert.not_nil(extra) + end) + end) + describe("should reject #invalid", function () local invalid_names = { ["empty string"] = "", ["characters"] = "<>"; |