aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-04 13:46:09 +0100
committerKim Alvefur <zash@zash.se>2019-03-04 13:46:09 +0100
commit2326bed3c7b2386aa1706ad0e760827ef2e165ce (patch)
treee47cbfb67c4f98b179baec19c2f4fd66e62f7132 /spec
parent9c9d32e7e69af9aa59c1937b91bc41525d584144 (diff)
parent09a662026a3fc4c69eda9d8ef8862abac5569625 (diff)
downloadprosody-2326bed3c7b2386aa1706ad0e760827ef2e165ce.tar.gz
prosody-2326bed3c7b2386aa1706ad0e760827ef2e165ce.zip
Merge 0.11->trunk
Diffstat (limited to 'spec')
-rw-r--r--spec/util_pubsub_spec.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/util_pubsub_spec.lua b/spec/util_pubsub_spec.lua
index 551aedd6..c982fb36 100644
--- a/spec/util_pubsub_spec.lua
+++ b/spec/util_pubsub_spec.lua
@@ -436,4 +436,45 @@ describe("util.pubsub", function ()
end);
end);
+ describe("node config checking", function ()
+ local service;
+ before_each(function ()
+ service = pubsub.new({
+ check_node_config = function (node, actor, config) -- luacheck: ignore 212
+ return config["max_items"] <= 20;
+ end;
+ });
+ end);
+
+ it("defaults, then configure", function ()
+ local ok, err = service:create("node", true);
+ assert.is_true(ok, err);
+
+ local ok, err = service:set_node_config("node", true, { max_items = 10 });
+ assert.is_true(ok, err);
+
+ local ok, err = service:set_node_config("node", true, { max_items = 100 });
+ assert.falsy(ok, err);
+ assert.equals(err, "not-acceptable");
+ end);
+
+ it("create with ok config, then configure", function ()
+ local ok, err = service:create("node", true, { max_items = 10 });
+ assert.is_true(ok, err);
+
+ local ok, err = service:set_node_config("node", true, { max_items = 100 });
+ assert.falsy(ok, err);
+
+ local ok, err = service:set_node_config("node", true, { max_items = 10 });
+ assert.is_true(ok, err);
+ end);
+
+ it("create with unacceptable config", function ()
+ local ok, err = service:create("node", true, { max_items = 100 });
+ assert.falsy(ok, err);
+ end);
+
+
+ end);
+
end);