Software /
code /
prosody
Changeset
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 (2018-08-12) |
parents | 9174:160032d55ff1 |
children | 9176:1068f9b82e2b |
files | spec/util_pubsub_spec.lua |
diffstat | 1 files changed, 24 insertions(+), 0 deletions(-) [+] |
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 ()