# HG changeset patch # User Matthew Wild # Date 1534070090 -3600 # Node ID 43b6f67aba05c653159bec63f6f85edd7c175695 # Parent 160032d55ff1db285cfa8952ac71787c3810764c util.pubsub tests: Add tests to confirm new access model is enforced on config change diff -r 160032d55ff1 -r 43b6f67aba05 spec/util_pubsub_spec.lua --- 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 ()