diff options
author | Kim Alvefur <zash@zash.se> | 2018-12-28 20:49:01 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-12-28 20:49:01 +0100 |
commit | b250ff0d70b614a5ee0025fc68f175428bfca4b5 (patch) | |
tree | df9a77b8e29ec164d9b9d8b877c42d141342e529 /spec/util_stanza_spec.lua | |
parent | 321a68c41995de92e3002c48c7df8571343dfd54 (diff) | |
download | prosody-b250ff0d70b614a5ee0025fc68f175428bfca4b5.tar.gz prosody-b250ff0d70b614a5ee0025fc68f175428bfca4b5.zip |
util.stanza: Require a type attribute for iq stanzas
Diffstat (limited to 'spec/util_stanza_spec.lua')
-rw-r--r-- | spec/util_stanza_spec.lua | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua index 6fbae41a..18e39554 100644 --- a/spec/util_stanza_spec.lua +++ b/spec/util_stanza_spec.lua @@ -95,20 +95,31 @@ describe("util.stanza", function() describe("#iq()", function() it("should create an iq stanza", function() - local i = st.iq({ id = "foo" }); + local i = st.iq({ type = "get", id = "foo" }); assert.are.equal("iq", i.name); assert.are.equal("foo", i.attr.id); + assert.are.equal("get", i.attr.type); end); - it("should reject stanzas with no id", function () + it("should reject stanzas with no attributes", function () assert.has.error_match(function () st.iq(); - end, "id attribute"); + end, "attributes"); + end); + + it("should reject stanzas with no id", function () assert.has.error_match(function () - st.iq({ foo = "bar" }); + st.iq({ type = "get" }); end, "id attribute"); end); + + it("should reject stanzas with no type", function () + assert.has.error_match(function () + st.iq({ id = "foo" }); + end, "type attribute"); + + end); end); describe("#presence()", function () |