Add bytecode generator for cic contracts unittests
This commit is contained in:
13
python/cic_contracts/unittest/__init__.py
Normal file
13
python/cic_contracts/unittest/__init__.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# standard imports
|
||||
import os
|
||||
|
||||
cic_unittest_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
contracts_dir = os.path.join(cic_unittest_dir, 'solidity')
|
||||
|
||||
|
||||
def bytecode(v):
|
||||
fp = os.path.join(contracts_dir, v.capitalize() + 'Test.bin')
|
||||
f = open(fp, 'r')
|
||||
r = f.read()
|
||||
f.close()
|
||||
return r
|
||||
22
python/cic_contracts/unittest/owned.py
Normal file
22
python/cic_contracts/unittest/owned.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# external imports
|
||||
from hexathon import strip_0x
|
||||
from hexathon import same as same_hex
|
||||
from chainlib.eth.nonce import RPCNonceOracle
|
||||
from chainlib.eth.address import to_checksum_address
|
||||
from eth_owned import Owned
|
||||
|
||||
|
||||
class TestInterface:
|
||||
|
||||
def __owned_check(self):
|
||||
self.owner == to_checksum_address(self.owner)
|
||||
|
||||
|
||||
def test_owner(self):
|
||||
self.__owned_check()
|
||||
|
||||
c = Owned(self.chain_spec)
|
||||
o = c.owner(self.address, sender_address=self.accounts[0])
|
||||
r = self.rpc.do(o)
|
||||
owner_address = c.parse_owner(r)
|
||||
self.assertTrue(same_hex(self.owner, owner_address))
|
||||
Reference in New Issue
Block a user