Fix/rename anyone account #1357 (#1718)

* replacing all instances of from: anyone with from: other

* replacing all instances of from: anyone with from: other

* replacing all instances of from: anyone with from: other

* changing anyone to other

* changing anyone to other
This commit is contained in:
ckshei
2019-04-11 08:34:10 -07:00
committed by Nicolás Venturo
parent d45f0c89db
commit 19c705d928
20 changed files with 107 additions and 107 deletions

View File

@ -16,18 +16,18 @@ function capitalize (str) {
//
// @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 other 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, [other], rolename, manager) {
rolename = capitalize(rolename);
describe('should behave like public role', function () {
beforeEach('check preconditions', async function () {
(await this.contract[`is${rolename}`](authorized)).should.equal(true);
(await this.contract[`is${rolename}`](otherAuthorized)).should.equal(true);
(await this.contract[`is${rolename}`](anyone)).should.equal(false);
(await this.contract[`is${rolename}`](other)).should.equal(false);
});
if (manager === undefined) { // Managed roles are only assigned by the manager, and none are set at construction
@ -52,7 +52,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
});
context('from unauthorized account', function () {
const from = anyone;
const from = other;
it('reverts', async function () {
await shouldFail.reverting(this.contract[`only${rolename}Mock`]({ from }));
@ -65,13 +65,13 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
context(`from ${manager ? 'the manager' : 'a role-haver'} account`, function () {
it('adds role to a new account', async function () {
await this.contract[`add${rolename}`](anyone, { from });
(await this.contract[`is${rolename}`](anyone)).should.equal(true);
await this.contract[`add${rolename}`](other, { from });
(await this.contract[`is${rolename}`](other)).should.equal(true);
});
it(`emits a ${rolename}Added event`, async function () {
const { logs } = await this.contract[`add${rolename}`](anyone, { from });
expectEvent.inLogs(logs, `${rolename}Added`, { account: anyone });
const { logs } = await this.contract[`add${rolename}`](other, { from });
expectEvent.inLogs(logs, `${rolename}Added`, { account: other });
});
it('reverts when adding role to an already assigned account', async function () {
@ -86,7 +86,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
describe('remove', function () {
// Non-managed roles have no restrictions on the mocked '_remove' function (exposed via 'remove').
const from = manager || anyone;
const from = manager || other;
context(`from ${manager ? 'the manager' : 'any'} account`, function () {
it('removes role from an already assigned account', async function () {
@ -101,7 +101,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
});
it('reverts when removing from an unassigned account', async function () {
await shouldFail.reverting(this.contract[`remove${rolename}`](anyone, { from }));
await shouldFail.reverting(this.contract[`remove${rolename}`](other, { from }));
});
it('reverts when removing role from the null account', async function () {
@ -122,7 +122,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
});
it('reverts when renouncing unassigned role', async function () {
await shouldFail.reverting(this.contract[`renounce${rolename}`]({ from: anyone }));
await shouldFail.reverting(this.contract[`renounce${rolename}`]({ from: other }));
});
});
});