mirror of
git://holbrook.no/eth-contract-registry
synced 2026-05-15 01:18:49 +02:00
Initial commit, ported from cic-registry
This commit is contained in:
1
python/contract_registry/pytest/__init__.py
Normal file
1
python/contract_registry/pytest/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .fixtures_registry import *
|
||||
36
python/contract_registry/pytest/fixtures_registry.py
Normal file
36
python/contract_registry/pytest/fixtures_registry.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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']
|
||||
|
||||
Reference in New Issue
Block a user