Add default role in test fixture

This commit is contained in:
nolash 2021-03-21 14:02:39 +01:00
parent 286914eb0e
commit e313638c7b
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
1 changed files with 6 additions and 4 deletions

View File

@ -14,7 +14,8 @@ from chainlib.eth.nonce import RPCNonceOracle
from contract_registry.registry import Registry
from contract_registry.encoding import to_identifier
logg = logging.getLogger(__name__)
#logg = logging.getLogger(__name__)
logg = logging.getLogger()
valid_identifiers = [
'ContractRegistry',
@ -26,9 +27,11 @@ def roles(
eth_accounts,
):
return {
'CONTRACT_DEPLOYER': eth_accounts[0],
'DEFAULT': eth_accounts[0],
'CONTRACT_DEPLOYER': eth_accounts[1],
}
@pytest.fixture(scope='function')
def registry(
default_chain_spec,
@ -43,13 +46,12 @@ def registry(
nonce_oracle = RPCNonceOracle(roles['CONTRACT_DEPLOYER'], eth_rpc)
builder = Registry(signer=eth_signer, nonce_oracle=nonce_oracle)
logg.info('registering identifiers {} in contract registry'.format(valid_identifiers))
(tx_hash_hex, o) = builder.constructor(roles['CONTRACT_DEPLOYER'], valid_identifiers)
r = eth_rpc.do(o)
logg.debug('r {}'.format(r))
o = receipt(r)
rcpt = eth_rpc.do(o)
assert rcpt['status'] == 1
registry_address = rcpt['contract_address']