Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
fd808b3f
Commit
fd808b3f
authored
Jan 17, 2019
by
Nicolás Venturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some barebones PublicRole.behavior documentation.
parent
6a658f2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
PublicRole.behavior.js
test/behavior/access/roles/PublicRole.behavior.js
+15
-0
No files found.
test/behavior/access/roles/PublicRole.behavior.js
View file @
fd808b3f
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment