2021-05-31 17:34:16 +02:00
|
|
|
# local imports
|
|
|
|
from cic_eth.api.api_task import Api
|
|
|
|
from cic_eth.task import BaseTask
|
|
|
|
|
|
|
|
def test_default_token(
|
|
|
|
default_chain_spec,
|
|
|
|
foo_token,
|
|
|
|
default_token,
|
|
|
|
token_registry,
|
|
|
|
register_tokens,
|
|
|
|
register_lookups,
|
|
|
|
cic_registry,
|
|
|
|
celery_session_worker,
|
|
|
|
):
|
|
|
|
|
|
|
|
api = Api(str(default_chain_spec), queue=None)
|
|
|
|
t = api.default_token()
|
|
|
|
r = t.get_leaf()
|
|
|
|
assert r['address'] == foo_token
|
2021-10-08 16:04:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_tokens(
|
|
|
|
default_chain_spec,
|
|
|
|
foo_token,
|
|
|
|
bar_token,
|
|
|
|
token_registry,
|
|
|
|
register_tokens,
|
|
|
|
register_lookups,
|
|
|
|
cic_registry,
|
|
|
|
init_database,
|
|
|
|
init_celery_tasks,
|
|
|
|
custodial_roles,
|
|
|
|
celery_worker,
|
|
|
|
):
|
|
|
|
|
|
|
|
api = Api(str(default_chain_spec), queue=None)
|
|
|
|
|
|
|
|
t = api.token('FOO')
|
|
|
|
r = t.get_leaf()
|
|
|
|
assert len(r) == 1
|
|
|
|
assert r[0]['address'] == foo_token
|
|
|
|
|
|
|
|
t = api.tokens(['BAR', 'FOO'])
|
|
|
|
r = t.get_leaf()
|
|
|
|
assert len(r) == 2
|
|
|
|
assert r[1]['address'] == foo_token
|
|
|
|
assert r[0]['address'] == bar_token
|