Add demurrage token amount adjust task
This commit is contained in:
0
apps/cic-eth/cic_eth/pytest/__init__.py
Normal file
0
apps/cic-eth/cic_eth/pytest/__init__.py
Normal file
@@ -37,7 +37,7 @@ def celery_includes():
|
||||
'cic_eth.eth.account',
|
||||
'cic_eth.callbacks.noop',
|
||||
'cic_eth.callbacks.http',
|
||||
'tests.mock.filter',
|
||||
'cic_eth.pytest.mock.filter',
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ logg = logging.getLogger(__name__)
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def load_config():
|
||||
config_dir = os.path.join(root_dir, 'config/test')
|
||||
config_dir = os.environ.get('CONFINI_DIR')
|
||||
if config_dir == None:
|
||||
config_dir = os.path.join(root_dir, 'config/test')
|
||||
conf = confini.Config(config_dir, 'CICTEST')
|
||||
conf.process()
|
||||
logg.debug('config {}'.format(conf))
|
||||
|
||||
19
apps/cic-eth/cic_eth/pytest/fixtures_token.py
Normal file
19
apps/cic-eth/cic_eth/pytest/fixtures_token.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# external imports
|
||||
import pytest
|
||||
from eth_erc20 import ERC20
|
||||
|
||||
# TODO: missing dep fixture includes
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def foo_token_symbol(
|
||||
default_chain_spec,
|
||||
foo_token,
|
||||
eth_rpc,
|
||||
contract_roles,
|
||||
):
|
||||
|
||||
c = ERC20(default_chain_spec)
|
||||
o = c.symbol(foo_token, sender_address=contract_roles['CONTRACT_DEPLOYER'])
|
||||
r = eth_rpc.do(o)
|
||||
return c.parse_symbol(r)
|
||||
1
apps/cic-eth/cic_eth/pytest/mock/__init__.py
Normal file
1
apps/cic-eth/cic_eth/pytest/mock/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .filter import *
|
||||
22
apps/cic-eth/cic_eth/pytest/mock/filter.py
Normal file
22
apps/cic-eth/cic_eth/pytest/mock/filter.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# third-party imports
|
||||
import celery
|
||||
import moolb
|
||||
|
||||
celery_app = celery.current_app
|
||||
|
||||
block_filter = moolb.Bloom(1024, 3)
|
||||
tx_filter = moolb.Bloom(1024, 3)
|
||||
lo = 0
|
||||
hi = 100
|
||||
|
||||
|
||||
@celery_app.task()
|
||||
def filter(address, offset, limit):
|
||||
return {
|
||||
'alg': 'sha256',
|
||||
'high': hi,
|
||||
'low': lo,
|
||||
'block_filter': block_filter.to_bytes().hex(),
|
||||
'blocktx_filter': tx_filter.to_bytes().hex(),
|
||||
'filter_rounds': 3,
|
||||
}
|
||||
Reference in New Issue
Block a user