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 | 9d19f12e262642a57e9957f9f439c9995e89b411 (patch) | |
tree | b423bd9b00971f228473922606a90030c4f984f1 /spec | |
parent | 330c5988edd7360d03bc835d2434bc02cd3529e8 (diff) | |
download | prosody-9d19f12e262642a57e9957f9f439c9995e89b411.tar.gz prosody-9d19f12e262642a57e9957f9f439c9995e89b411.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 () |