util.pubsub tests: Add initial node config tests
authorMatthew Wild <mwild1@gmail.com>
Sun, 12 Aug 2018 11:34:28 +0100
changeset 9177 160032d55ff1
parent 9176 c53663e13b51
child 9178 43b6f67aba05
util.pubsub tests: Add initial node config tests
spec/util_pubsub_spec.lua
--- a/spec/util_pubsub_spec.lua	Sun Aug 12 11:34:05 2018 +0100
+++ b/spec/util_pubsub_spec.lua	Sun Aug 12 11:34:28 2018 +0100
@@ -124,6 +124,24 @@
 
 	end);
 
+	describe("node config", function ()
+		local service;
+		before_each(function ()
+			service = pubsub.new();
+			service:create("test", true);
+		end);
+		it("access is forbidden for unaffiliated entities", function ()
+			local ok, err = service:get_node_config("test", "stranger");
+			assert.is_falsy(ok);
+			assert.equals("forbidden", err);
+		end);
+		it("returns an error for nodes that do not exist", function ()
+			local ok, err = service:get_node_config("nonexistent", true);
+			assert.is_falsy(ok);
+			assert.equals("item-not-found", err);
+		end);
+	end);
+
 	describe("access model", function ()
 		describe("open", function ()
 			local service;