diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-08-12 11:34:50 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-08-12 11:34:50 +0100 |
commit | df0a87fa8b267299ce30eca338140c0bbc91bdea (patch) | |
tree | b423bd9b00971f228473922606a90030c4f984f1 /spec | |
parent | bdc1aa1462d4960f907ee778e6e5d9726ec6291a (diff) | |
download | prosody-df0a87fa8b267299ce30eca338140c0bbc91bdea.tar.gz prosody-df0a87fa8b267299ce30eca338140c0bbc91bdea.zip |
util.pubsub tests: Add tests to confirm new access model is enforced on config change
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_pubsub_spec.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/util_pubsub_spec.lua b/spec/util_pubsub_spec.lua index d63e2206..2c7676ea 100644 --- a/spec/util_pubsub_spec.lua +++ b/spec/util_pubsub_spec.lua @@ -181,6 +181,30 @@ describe("util.pubsub", function () 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 () |