Add some barebones PublicRole.behavior documentation.

pull/1613/head
Nicolás Venturo 6 years ago
parent 6a658f2ac8
commit fd808b3ff8
  1. 15
      test/behavior/access/roles/PublicRole.behavior.js

@ -5,6 +5,21 @@ function capitalize (str) {
return str.replace(/\b\w/g, l => l.toUpperCase()); 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) { function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], rolename, manager) {
rolename = capitalize(rolename); rolename = capitalize(rolename);

Loading…
Cancel
Save