From fd808b3ff8c0787608a2a776cc02f07a0ed10ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Thu, 17 Jan 2019 20:27:51 -0300 Subject: [PATCH] Add some barebones PublicRole.behavior documentation. --- test/behavior/access/roles/PublicRole.behavior.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/behavior/access/roles/PublicRole.behavior.js b/test/behavior/access/roles/PublicRole.behavior.js index 4c4f34706..3a673e6a0 100644 --- a/test/behavior/access/roles/PublicRole.behavior.js +++ b/test/behavior/access/roles/PublicRole.behavior.js @@ -5,6 +5,21 @@ function capitalize (str) { return str.replace(/\b\w/g, l => l.toUpperCase()); } +// Tests that a role complies with the standard role interface, that is: +// * an onlyRole modifier +// * an isRole function +// * an addRole function, accessible to role havers +// * a renounceRole function +// * roleAdded and roleRemoved events +// Both the modifier and an additional internal remove function are tested through a mock contract that exposes them. +// This mock contract should be stored in this.contract. +// +// @param authorized an account that has the role +// @param otherAuthorized another account that also has the role +// @param anyone an account that doesn't have the role, passed inside an array for ergonomics +// @param rolename a string with the name of the role +// @param manager undefined for regular roles, or a manager account for managed roles. In these, only the manager +// account can create and remove new role bearers. function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], rolename, manager) { rolename = capitalize(rolename);