Commit e1f40e7e by Nicolás Venturo

Merge branch 'release-2.1.2'

parents b7d60f2f 8617c4b4
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
### Breaking changes: ### Breaking changes:
## 2.1.2 (2019-17-01)
* Removed most of the test suite from the npm package, except `PublicRole.behavior.js`, which may be useful to users testing their own `Roles`.
## 2.1.1 (2019-04-01) ## 2.1.1 (2019-04-01)
* Version bump to avoid conflict in the npm registry. * Version bump to avoid conflict in the npm registry.
......
{ {
"package_name": "zeppelin", "package_name": "zeppelin",
"version": "2.1.1", "version": "2.1.2",
"description": "Secure Smart Contract library for Solidity", "description": "Secure Smart Contract library for Solidity",
"authors": [ "authors": [
"OpenZeppelin Community <maintainers@openzeppelin.org>" "OpenZeppelin Community <maintainers@openzeppelin.org>"
......
{ {
"name": "openzeppelin-solidity", "name": "openzeppelin-solidity",
"version": "2.1.1", "version": "2.1.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
......
{ {
"name": "openzeppelin-solidity", "name": "openzeppelin-solidity",
"version": "2.1.1", "version": "2.1.2",
"description": "Secure Smart Contract library for Solidity", "description": "Secure Smart Contract library for Solidity",
"files": [ "files": [
"build", "build",
"contracts", "contracts",
"test" "test/behaviors"
], ],
"scripts": { "scripts": {
"build": "scripts/build.sh", "build": "scripts/build.sh",
......
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
const CapperRoleMock = artifacts.require('CapperRoleMock'); const CapperRoleMock = artifacts.require('CapperRoleMock');
contract('CapperRole', function ([_, capper, otherCapper, ...otherAccounts]) { contract('CapperRole', function ([_, capper, otherCapper, ...otherAccounts]) {
......
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
const MinterRoleMock = artifacts.require('MinterRoleMock'); const MinterRoleMock = artifacts.require('MinterRoleMock');
contract('MinterRole', function ([_, minter, otherMinter, ...otherAccounts]) { contract('MinterRole', function ([_, minter, otherMinter, ...otherAccounts]) {
......
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
const PauserRoleMock = artifacts.require('PauserRoleMock'); const PauserRoleMock = artifacts.require('PauserRoleMock');
contract('PauserRole', function ([_, pauser, otherPauser, ...otherAccounts]) { contract('PauserRole', function ([_, pauser, otherPauser, ...otherAccounts]) {
......
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
const SignerRoleMock = artifacts.require('SignerRoleMock'); const SignerRoleMock = artifacts.require('SignerRoleMock');
contract('SignerRole', function ([_, signer, otherSigner, ...otherAccounts]) { contract('SignerRole', function ([_, signer, otherSigner, ...otherAccounts]) {
......
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
const WhitelistAdminRoleMock = artifacts.require('WhitelistAdminRoleMock'); const WhitelistAdminRoleMock = artifacts.require('WhitelistAdminRoleMock');
contract('WhitelistAdminRole', function ([_, whitelistAdmin, otherWhitelistAdmin, ...otherAccounts]) { contract('WhitelistAdminRole', function ([_, whitelistAdmin, otherWhitelistAdmin, ...otherAccounts]) {
......
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
const WhitelistedRoleMock = artifacts.require('WhitelistedRoleMock'); const WhitelistedRoleMock = artifacts.require('WhitelistedRoleMock');
contract('WhitelistedRole', function ([_, whitelisted, otherWhitelisted, whitelistAdmin, ...otherAccounts]) { contract('WhitelistedRole', function ([_, whitelisted, otherWhitelisted, whitelistAdmin, ...otherAccounts]) {
......
...@@ -5,6 +5,21 @@ function capitalize (str) { ...@@ -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);
......
...@@ -2,7 +2,7 @@ const { BN, ether, shouldFail } = require('openzeppelin-test-helpers'); ...@@ -2,7 +2,7 @@ const { BN, ether, shouldFail } = require('openzeppelin-test-helpers');
const IndividuallyCappedCrowdsaleImpl = artifacts.require('IndividuallyCappedCrowdsaleImpl'); const IndividuallyCappedCrowdsaleImpl = artifacts.require('IndividuallyCappedCrowdsaleImpl');
const SimpleToken = artifacts.require('SimpleToken'); const SimpleToken = artifacts.require('SimpleToken');
const { shouldBehaveLikePublicRole } = require('../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../behaviors/access/roles/PublicRole.behavior');
contract('IndividuallyCappedCrowdsale', function ( contract('IndividuallyCappedCrowdsale', function (
[_, capper, otherCapper, wallet, alice, bob, charlie, anyone, ...otherAccounts]) { [_, capper, otherCapper, wallet, alice, bob, charlie, anyone, ...otherAccounts]) {
......
const { shouldFail } = require('openzeppelin-test-helpers'); const { shouldFail } = require('openzeppelin-test-helpers');
const { getSignFor } = require('../helpers/sign'); const { getSignFor } = require('../helpers/sign');
const { shouldBehaveLikePublicRole } = require('../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../behaviors/access/roles/PublicRole.behavior');
const SignatureBouncerMock = artifacts.require('SignatureBouncerMock'); const SignatureBouncerMock = artifacts.require('SignatureBouncerMock');
......
const { expectEvent, shouldFail } = require('openzeppelin-test-helpers'); const { expectEvent, shouldFail } = require('openzeppelin-test-helpers');
const { shouldBehaveLikePublicRole } = require('../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../behaviors/access/roles/PublicRole.behavior');
const PausableMock = artifacts.require('PausableMock'); const PausableMock = artifacts.require('PausableMock');
......
const { shouldBehaveLikeERC20Mintable } = require('./behaviors/ERC20Mintable.behavior'); const { shouldBehaveLikeERC20Mintable } = require('./behaviors/ERC20Mintable.behavior');
const ERC20MintableMock = artifacts.require('ERC20MintableMock'); const ERC20MintableMock = artifacts.require('ERC20MintableMock');
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
contract('ERC20Mintable', function ([_, minter, otherMinter, ...otherAccounts]) { contract('ERC20Mintable', function ([_, minter, otherMinter, ...otherAccounts]) {
beforeEach(async function () { beforeEach(async function () {
......
const { BN, expectEvent, shouldFail } = require('openzeppelin-test-helpers'); const { BN, expectEvent, shouldFail } = require('openzeppelin-test-helpers');
const ERC20PausableMock = artifacts.require('ERC20PausableMock'); const ERC20PausableMock = artifacts.require('ERC20PausableMock');
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
contract('ERC20Pausable', function ([_, pauser, otherPauser, recipient, anotherAccount, ...otherAccounts]) { contract('ERC20Pausable', function ([_, pauser, otherPauser, recipient, anotherAccount, ...otherAccounts]) {
const initialSupply = new BN(100); const initialSupply = new BN(100);
......
require('openzeppelin-test-helpers'); require('openzeppelin-test-helpers');
const { shouldBehaveLikeERC721PausedToken } = require('./ERC721PausedToken.behavior'); const { shouldBehaveLikeERC721PausedToken } = require('./ERC721PausedToken.behavior');
const { shouldBehaveLikeERC721 } = require('./ERC721.behavior'); const { shouldBehaveLikeERC721 } = require('./ERC721.behavior');
const { shouldBehaveLikePublicRole } = require('../../access/roles/PublicRole.behavior'); const { shouldBehaveLikePublicRole } = require('../../behaviors/access/roles/PublicRole.behavior');
const ERC721PausableMock = artifacts.require('ERC721PausableMock.sol'); const ERC721PausableMock = artifacts.require('ERC721PausableMock.sol');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment