From 6455b96c79de601935f505475a4fb45c73146784 Mon Sep 17 00:00:00 2001 From: adklempner Date: Mon, 19 Sep 2016 15:35:03 -0700 Subject: [PATCH] Test that Ownable prevents non-owners from changing ownership. --- test/ownable.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/ownable.js b/test/ownable.js index 2f61269ae..163e985e3 100644 --- a/test/ownable.js +++ b/test/ownable.js @@ -10,7 +10,7 @@ contract('Ownable', function(accounts) { it("changes owner after transfer", function(done) { var ownable = Ownable.deployed(); - var other = '0xe682569efa3752a07fdc09885007c47beee803a7'; + var other = accounts[1]; return ownable.transfer(other) .then(function() { return ownable.owner(); @@ -20,4 +20,18 @@ contract('Ownable', function(accounts) { }) .then(done) }); + + it("should prevent non-owners from transfering" ,function(done) { + var ownable = Ownable.deployed(); + var other = accounts[2]; + return ownable.transfer(other, {from: accounts[2]}) + .then(function() { + return ownable.owner(); + }) + .then(function(owner) { + assert.isFalse(owner === other); + }) + .then(done) + }); + });