Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
10445:f53c03ab4357 | 10446:5c2d1b13537c |
---|---|
189 it("should work for <s>", function() | 189 it("should work for <s>", function() |
190 -- Test stanza | 190 -- Test stanza |
191 local s = st.stanza("s", { to = "touser", from = "fromuser", id = "123" }) | 191 local s = st.stanza("s", { to = "touser", from = "fromuser", id = "123" }) |
192 :tag("child1"); | 192 :tag("child1"); |
193 -- Make reply stanza | 193 -- Make reply stanza |
194 local r = st.error_reply(s, "cancel", "service-unavailable"); | 194 local r = st.error_reply(s, "cancel", "service-unavailable", nil, "host"); |
195 assert.are.equal(r.name, s.name); | 195 assert.are.equal(r.name, s.name); |
196 assert.are.equal(r.id, s.id); | 196 assert.are.equal(r.id, s.id); |
197 assert.are.equal(r.attr.to, s.attr.from); | 197 assert.are.equal(r.attr.to, s.attr.from); |
198 assert.are.equal(r.attr.from, s.attr.to); | 198 assert.are.equal(r.attr.from, s.attr.to); |
199 assert.are.equal(#r.tags, 1); | 199 assert.are.equal(#r.tags, 1); |
200 assert.are.equal(r.tags[1].tags[1].name, "service-unavailable"); | 200 assert.are.equal(r.tags[1].tags[1].name, "service-unavailable"); |
201 assert.are.equal(r.tags[1].attr.by, "host"); | |
201 end); | 202 end); |
202 | 203 |
203 it("should work for <iq get>", function() | 204 it("should work for <iq get>", function() |
204 -- Test stanza | 205 -- Test stanza |
205 local s = st.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" }) | 206 local s = st.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" }) |