mirror of
git://holbrook.no/eth-contract-registry
synced 2024-11-16 14:36:46 +01:00
37 lines
770 B
Python
37 lines
770 B
Python
|
# standard imports
|
||
|
import logging
|
||
|
|
||
|
# external imports
|
||
|
import pytest
|
||
|
from chainlib.eth.connection import RPCConnection
|
||
|
from chainlib.eth.tx import receipt
|
||
|
|
||
|
# local imports
|
||
|
from contract_registry.registry import Registry
|
||
|
|
||
|
logg = logging.getLogger(__name__)
|
||
|
|
||
|
valid_identifiers = [
|
||
|
'ContractRegistry',
|
||
|
]
|
||
|
|
||
|
@pytest.fixture(scope='function')
|
||
|
def registry(
|
||
|
init_eth_tester,
|
||
|
init_eth_rpc,
|
||
|
eth_accounts,
|
||
|
):
|
||
|
|
||
|
conn = RPCConnection.connect('default')
|
||
|
builder = Registry(signer=conn.signer)
|
||
|
(tx_hash_hex, o) = builder.constructor(eth_accounts[0], valid_identifiers)
|
||
|
r = conn.do(o)
|
||
|
logg.debug('r {}'.format(r))
|
||
|
|
||
|
o = receipt(r)
|
||
|
rcpt = conn.do(o)
|
||
|
|
||
|
assert rcpt['status'] == 1
|
||
|
return rcpt['contract_address']
|
||
|
|