mirror of https://github.com/nucypher/nucypher.git
[KMS-ETH]- Extend token lanuch/fetch test with newer api and a more narrative format.
parent
ed1f99b011
commit
9bacbab86c
|
@ -4,21 +4,37 @@ from pytest import raises
|
|||
from nkms_eth.token import NuCypherKMSToken
|
||||
|
||||
|
||||
def test_create_and_get_nucypherkms_token(testerchain):
|
||||
def test_launch_and_fetch_nucypherkms_token(testerchain):
|
||||
|
||||
# Trying to get token from blockchain before it's been published fails
|
||||
with raises(NoKnownAddress):
|
||||
NuCypherKMSToken.get(blockchain=testerchain)
|
||||
|
||||
# Create a token instance
|
||||
token = NuCypherKMSToken(blockchain=testerchain)
|
||||
|
||||
# Make sure we got the name right
|
||||
contract_identifier = NuCypherKMSToken._NuCypherKMSToken__contract_name
|
||||
assert'NuCypherKMSToken' == contract_identifier
|
||||
|
||||
# The big day...
|
||||
with raises(NuCypherKMSToken.ContractDeploymentError):
|
||||
token.deploy()
|
||||
|
||||
# Token must be armed before deploying to the blockchain
|
||||
token.arm()
|
||||
token.deploy()
|
||||
|
||||
# Ensure the contract is deployed and has a valid blockchain address
|
||||
assert len(token._contract.address) == 42
|
||||
assert token._contract.call().totalSupply() != 0
|
||||
# assert token.contract.call().totalSupply() == 10 ** 9 - 1
|
||||
|
||||
# Check that the token contract has tokens
|
||||
assert token().totalSupply() != 0
|
||||
# assert token().totalSupply() == 10 ** 9 - 1 # TODO
|
||||
|
||||
# Retrieve the token from the blockchain
|
||||
same_token = NuCypherKMSToken.get(blockchain=testerchain)
|
||||
|
||||
assert token._contract.address == same_token.contract.address
|
||||
assert token == same_token
|
||||
|
||||
|
||||
# Compare the contract address for equality
|
||||
assert token._contract.address == same_token._contract.address
|
||||
assert token == same_token # __eq__
|
||||
|
|
|
@ -24,6 +24,6 @@ def test_nucypher_populus_project(testerchain):
|
|||
# ...and on the testerchain/blockchain class itself
|
||||
assert testerchain._project.project_dir == populus_project_dir
|
||||
|
||||
# Ensure that smart contacts are available, post solidity compile.
|
||||
token_contract_identifier = NuCypherKMSToken.__contract_name
|
||||
# Ensure that solidity smart contacts are available, post-compile.
|
||||
token_contract_identifier = NuCypherKMSToken._NuCypherKMSToken__contract_name
|
||||
assert token_contract_identifier in testerchain._project.compiled_contract_data
|
Loading…
Reference in New Issue