cic-internal-integration/apps/cic-eth/tests/fixtures_registry.py

30 lines
947 B
Python
Raw Normal View History

2021-03-12 18:44:29 +01:00
# external imports
2021-02-17 09:19:42 +01:00
import pytest
2021-03-13 21:31:37 +01:00
from cic_registry import CICRegistry
2021-03-12 18:44:29 +01:00
from chainlib.chain import ChainSpec
2021-03-13 21:31:37 +01:00
from eth_accounts_index import AccountRegistry
2021-02-17 09:19:42 +01:00
@pytest.fixture(scope='session')
2021-03-12 18:44:29 +01:00
def default_chain_spec():
return ChainSpec('evm', 'bloxberg', 8996)
2021-03-13 21:31:37 +01:00
@pytest.fixture(scope='session')
def accounts_registry(
default_chain_spec,
cic_registry,
):
#abi = AccountRegistry.abi()
#constructor = w3.eth.contract(abi=abi, bytecode=AccountRegistry.bytecode())
#tx_hash = constructor.constructor().transact()
r = w3.eth.getTransactionReceipt(tx_hash)
logg.debug('accounts registry deployed {}'.format(r.contractAddress))
account_registry = AccountRegistry(w3, r.contractAddress)
c = w3.eth.contract(abi=abi, address=r.contractAddress)
c.functions.addWriter(w3.eth.accounts[0]).transact()
CICRegistry.add_contract(default_chain_spec, c, 'AccountRegistry')
return account_registry