aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-08-12 11:34:50 +0100
committerMatthew Wild <mwild1@gmail.com>2018-08-12 11:34:50 +0100
commit9d19f12e262642a57e9957f9f439c9995e89b411 (patch)
treeb423bd9b00971f228473922606a90030c4f984f1
parent330c5988edd7360d03bc835d2434bc02cd3529e8 (diff)
downloadprosody-9d19f12e262642a57e9957f9f439c9995e89b411.tar.gz
prosody-9d19f12e262642a57e9957f9f439c9995e89b411.zip
util.pubsub tests: Add tests to confirm new access model is enforced on config change
-rw-r--r--spec/util_pubsub_spec.lua24
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 ()