Software /
code /
prosody
Diff
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 |
line wrap: on
line diff
--- a/spec/util_pubsub_spec.lua Sun Aug 12 11:34:28 2018 +0100 +++ b/spec/util_pubsub_spec.lua Sun Aug 12 11:34:50 2018 +0100 @@ -181,6 +181,30 @@ assert.equals("forbidden", err); end); end); + describe("change", function () + local service; + before_each(function () + service = pubsub.new(); + service:create("test", true, { access_model = "open" }); + end); + it("affects existing subscriptions", function () + do + local ok = service:add_subscription("test", "stranger", "stranger"); + assert.is_true(ok); + end + do + local ok, sub = service:get_subscription("test", "stranger", "stranger"); + assert.is_true(ok); + assert.is_true(sub); + end + assert(service:set_node_config("test", true, { access_model = "whitelist" })); + do + local ok, sub = service:get_subscription("test", "stranger", "stranger"); + assert.is_true(ok); + assert.is_nil(sub); + end + end); + end); end); describe("publish model", function ()