cic-internal-integration/apps/cic-eth/tests/tasks/test_token_tasks.py

52 lines
1.1 KiB
Python
Raw Normal View History

2021-02-01 18:12:51 +01:00
# standard imports
import logging
# third-party imports
import celery
# local imports
from cic_eth.eth.token import TokenTxFactory
logg = logging.getLogger()
def test_approve(
init_rpc,
default_chain_spec,
celery_session_worker,
bancor_tokens,
bancor_registry,
cic_registry,
):
2021-03-06 18:55:51 +01:00
token_data = [
2021-02-01 18:12:51 +01:00
{
'address': bancor_tokens[0],
},
2021-03-06 18:55:51 +01:00
]
s_nonce = celery.signature(
'cic_eth.eth.tx.reserve_nonce',
[
token_data,
init_rpc.w3.eth.accounts[0],
],
queue=None,
)
s_approve = celery.signature(
'cic_eth.eth.token.approve',
[
2021-02-01 18:12:51 +01:00
init_rpc.w3.eth.accounts[0],
init_rpc.w3.eth.accounts[1],
1024,
str(default_chain_spec),
],
)
2021-03-06 18:55:51 +01:00
s_nonce.link(s_approve)
t = s_nonce.apply_async()
2021-02-01 18:12:51 +01:00
t.get()
for r in t.collect():
logg.debug('result {}'.format(r))
assert t.successful()