Diff

spec/util_pubsub_spec.lua @ 9174:160032d55ff1

util.pubsub tests: Add initial node config tests
author Matthew Wild <mwild1@gmail.com>
date Sun, 12 Aug 2018 11:34:28 +0100
parent 9173:c53663e13b51
child 9175:43b6f67aba05
line wrap: on
line diff
--- 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;