eth-contract-registry/python/contract_registry/pytest/fixtures_registry.py

37 lines
770 B
Python
Raw Normal View History

# 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']