Comparison

spec/util_stanza_spec.lua @ 10444:4eab1f5a4f3b

util.stanza: Check that argument to error_reply is a stanza
author Kim Alvefur <zash@zash.se>
date Mon, 25 Nov 2019 20:52:01 +0100
parent 10443:f28718f46196
child 10445:f53c03ab4357
comparison
equal deleted inserted replaced
10443:f28718f46196 10444:4eab1f5a4f3b
212 assert.are.equal(r.attr.from, s.attr.to); 212 assert.are.equal(r.attr.from, s.attr.to);
213 assert.are.equal(r.attr.type, "error"); 213 assert.are.equal(r.attr.type, "error");
214 assert.are.equal(#r.tags, 1); 214 assert.are.equal(#r.tags, 1);
215 assert.are.equal(r.tags[1].tags[1].name, "service-unavailable"); 215 assert.are.equal(r.tags[1].tags[1].name, "service-unavailable");
216 end); 216 end);
217
218 it("should reject not-stanzas", function ()
219 assert.has.error_match(function ()
220 st.error_reply(not "a stanza", "modify", "bad-request");
221 end, "expected stanza");
222 end);
217 end); 223 end);
218 224
219 describe("should reject #invalid", function () 225 describe("should reject #invalid", function ()
220 local invalid_names = { 226 local invalid_names = {
221 ["empty string"] = "", ["characters"] = "<>"; 227 ["empty string"] = "", ["characters"] = "<>";