Advertisement
Guest User

Untitled

a guest
Feb 4th, 2020
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. var CarData = artifacts.require("./CarData.sol");
  2.  
  3. contract("CarData", function(accounts) {
  4. //setting up the account[1] will lead to revert, because account[1] is not allowed to call the method
  5. it('should revert the transaction of insertCarData when the from parameter is not the owner of the contract', function() {
  6. return CarData.deployed()
  7. .then(function (instance) {
  8. instance = CarData.at('0x34e92dda73951fd2245c70f396f7379af21e9148');
  9.  
  10. instance.getPastEvents('logCarDataInserted', {
  11. filter: {},
  12. fromBlock: 0,
  13. toBlock: 'latest'
  14. }, function(error, result) {
  15. if(error) {
  16. console.log(error, 'error');
  17. } else {
  18. console.log(result, 'result');
  19. }
  20. });
  21.  
  22. return instance.insertCarData("BG123456641", 1529767983, 1529767983, 1529767983, "1994", "Bulgaria", "Red", {from: accounts[0]});
  23. });
  24. });
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement