2018-05-20 02:36:34 +00:00
|
|
|
|
|
|
|
exports.Test = (contractsConfig, afterDeploy) => {
|
|
|
|
|
|
|
|
describe("Controlled", async function() {
|
|
|
|
this.timeout(0);
|
|
|
|
var Controlled;
|
|
|
|
var accountsArr;
|
|
|
|
before(function(done) {
|
2018-07-18 14:30:44 +00:00
|
|
|
config(contractsConfig, async function(accounts) {
|
2018-05-20 02:36:34 +00:00
|
|
|
Controlled = Contract;
|
|
|
|
accountsArr = accounts;
|
|
|
|
await afterDeploy(accounts, Contract);
|
|
|
|
done()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it("should start with msg.sender as controller", async function() {
|
|
|
|
var controller = await Controlled.methods.controller().call();
|
|
|
|
assert(controller, accountsArr[0]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should allow controller to set new controller", async function() {
|
|
|
|
await Controlled.methods.changeController(accountsArr[1]).send({from: accountsArr[0]});
|
|
|
|
var controller = await Controlled.methods.controller().call();
|
|
|
|
assert(controller, accountsArr[1]);
|
|
|
|
});
|
|
|
|
});
|
2018-07-18 14:30:44 +00:00
|
|
|
}
|