Diff

spec/util_stanza_spec.lua @ 10446:5c2d1b13537c

util.stanza: Support the 'by' attribute on errors This is to be used when the entity generating the error is not the same as the one the stanza was directed to, e.g. an intermediate server.
author Kim Alvefur <zash@zash.se>
date Mon, 25 Nov 2019 20:59:36 +0100
parent 10445:f53c03ab4357
child 10503:e25a1a9a6e7e
line wrap: on
line diff
--- a/spec/util_stanza_spec.lua	Mon Nov 25 20:52:03 2019 +0100
+++ b/spec/util_stanza_spec.lua	Mon Nov 25 20:59:36 2019 +0100
@@ -191,13 +191,14 @@
 			local s = st.stanza("s", { to = "touser", from = "fromuser", id = "123" })
 				:tag("child1");
 			-- Make reply stanza
-			local r = st.error_reply(s, "cancel", "service-unavailable");
+			local r = st.error_reply(s, "cancel", "service-unavailable", nil, "host");
 			assert.are.equal(r.name, s.name);
 			assert.are.equal(r.id, s.id);
 			assert.are.equal(r.attr.to, s.attr.from);
 			assert.are.equal(r.attr.from, s.attr.to);
 			assert.are.equal(#r.tags, 1);
 			assert.are.equal(r.tags[1].tags[1].name, "service-unavailable");
+			assert.are.equal(r.tags[1].attr.by, "host");
 		end);
 
 		it("should work for <iq get>", function()