base.py (1654B)
1 # standard imports 2 import logging 3 4 # external imports 5 from chainlib.eth.unittest.ethtester import EthTesterCase 6 from chainlib.connection import RPCConnection 7 from chainlib.eth.nonce import RPCNonceOracle 8 from chainlib.eth.address import to_checksum_address 9 from chainlib.eth.tx import receipt 10 11 # local imports 12 from craft_nft import CraftNFT 13 14 15 logg = logging.getLogger(__name__) 16 17 18 class TestCraftNFT(EthTesterCase): 19 20 def setUp(self): 21 super(TestCraftNFT, self).setUp() 22 nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) 23 c = CraftNFT(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) 24 (tx_hash, o) = c.constructor(self.accounts[0], 'DevBadge', 'DEV') 25 self.conn = RPCConnection.connect(self.chain_spec, 'default') 26 r = self.conn.do(o) 27 logg.debug('smart contract published with hash {}'.format(r)) 28 29 o = receipt(r) 30 r = self.conn.do(o) 31 self.address = to_checksum_address(r['contract_address']) 32 33 34 35 class TestCraftNFTEnumerated(EthTesterCase): 36 37 def setUp(self): 38 super(TestCraftNFT, self).setUp() 39 nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) 40 c = CraftNFT(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) 41 (tx_hash, o) = c.constructor(self.accounts[0], 'DevBadge', 'DEV', enumeration=True) 42 self.conn = RPCConnection.connect(self.chain_spec, 'default') 43 r = self.conn.do(o) 44 logg.debug('smart contract published with hash {}'.format(r)) 45 46 o = receipt(r) 47 r = self.conn.do(o) 48 self.address = to_checksum_address(r['contract_address'])