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

View File

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