Guest User

Untitled

a guest
Oct 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. const certificate = contract(Certificate);
  2. certificate.setProvider(web3.currentProvider);
  3. var certificateInstance =
  4. certificate.at("0xfcdf59a5e2a43059d3d469f4aa31534d6c0d00b7");
  5. return certificateInstance
  6. .ownerName() // state variable in the contract
  7. .then(function(_ownerName) {
  8. console.log(_ownerName);
  9. // getParam2 is the function with onlyOwner modifier
  10. return certificateInstance.getParam2({ from: owner });
  11. })
  12. .then(function(_value) {
  13. console.log(_value);
  14. });
  15.  
  16. ...
  17. return Certificate.at(certAddress);
  18. }).then(function(instance){
  19. certInstance = instance;
  20. return certInstance.getParam2({from: owner});
  21. }).then(function(_value){
  22. assert.equal(_value, "param2value", "modifier function returns correct value"
  23. })
Add Comment
Please, Sign In to add comment