Add bytecode generator for cic contracts unittests

This commit is contained in:
lash
2023-06-08 14:00:23 +01:00
parent a7b0858baa
commit 6aa0319407
22 changed files with 789 additions and 250 deletions

View 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

View 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))