From 9d19f12e262642a57e9957f9f439c9995e89b411 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 12 Aug 2018 11:34:50 +0100 Subject: util.pubsub tests: Add tests to confirm new access model is enforced on config change --- spec/util_pubsub_spec.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'spec') 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 () -- cgit v1.2.3