Software /
code /
prosody
Comparison
spec/util_pubsub_spec.lua @ 9175:43b6f67aba05
util.pubsub tests: Add tests to confirm new access model is enforced on config change
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 12 Aug 2018 11:34:50 +0100 |
parent | 9174:160032d55ff1 |
child | 9176:1068f9b82e2b |
comparison
equal
deleted
inserted
replaced
9174:160032d55ff1 | 9175:43b6f67aba05 |
---|---|
179 local ok, err = service:add_subscription("test", "stranger", "stranger"); | 179 local ok, err = service:add_subscription("test", "stranger", "stranger"); |
180 assert.is_false(ok); | 180 assert.is_false(ok); |
181 assert.equals("forbidden", err); | 181 assert.equals("forbidden", err); |
182 end); | 182 end); |
183 end); | 183 end); |
184 describe("change", function () | |
185 local service; | |
186 before_each(function () | |
187 service = pubsub.new(); | |
188 service:create("test", true, { access_model = "open" }); | |
189 end); | |
190 it("affects existing subscriptions", function () | |
191 do | |
192 local ok = service:add_subscription("test", "stranger", "stranger"); | |
193 assert.is_true(ok); | |
194 end | |
195 do | |
196 local ok, sub = service:get_subscription("test", "stranger", "stranger"); | |
197 assert.is_true(ok); | |
198 assert.is_true(sub); | |
199 end | |
200 assert(service:set_node_config("test", true, { access_model = "whitelist" })); | |
201 do | |
202 local ok, sub = service:get_subscription("test", "stranger", "stranger"); | |
203 assert.is_true(ok); | |
204 assert.is_nil(sub); | |
205 end | |
206 end); | |
207 end); | |
184 end); | 208 end); |
185 | 209 |
186 describe("publish model", function () | 210 describe("publish model", function () |
187 describe("publishers", function () | 211 describe("publishers", function () |
188 local service; | 212 local service; |