cic-eth: Complex balance
This commit is contained in:
@@ -29,27 +29,6 @@ def test_account_api(
|
||||
assert t.successful()
|
||||
|
||||
|
||||
def test_balance_api(
|
||||
default_chain_spec,
|
||||
default_chain_registry,
|
||||
init_w3,
|
||||
cic_registry,
|
||||
init_database,
|
||||
bancor_tokens,
|
||||
bancor_registry,
|
||||
celery_session_worker,
|
||||
):
|
||||
|
||||
token = CICRegistry.get_address(default_chain_spec, bancor_tokens[0])
|
||||
|
||||
api = Api(str(default_chain_spec), callback_param='balance', callback_task='cic_eth.callbacks.noop.noop', queue=None)
|
||||
t = api.balance(init_w3.eth.accounts[2], token.symbol())
|
||||
t.get()
|
||||
for r in t.collect():
|
||||
print(r)
|
||||
assert t.successful()
|
||||
|
||||
|
||||
def test_transfer_api(
|
||||
default_chain_spec,
|
||||
init_w3,
|
||||
|
||||
40
apps/cic-eth/tests/functional/test_balance.py
Normal file
40
apps/cic-eth/tests/functional/test_balance.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# standard imports
|
||||
import os
|
||||
import logging
|
||||
|
||||
# local imports
|
||||
import web3
|
||||
from cic_eth.api.api_task import Api
|
||||
|
||||
logg = logging.getLogger()
|
||||
|
||||
|
||||
def test_balance_complex_api(
|
||||
default_chain_spec,
|
||||
init_database,
|
||||
init_w3,
|
||||
cic_registry,
|
||||
dummy_token,
|
||||
dummy_token_registered,
|
||||
celery_session_worker,
|
||||
init_eth_tester,
|
||||
):
|
||||
|
||||
chain_str = str(default_chain_spec)
|
||||
|
||||
api = Api(chain_str, queue=None, callback_param='foo')
|
||||
|
||||
a = web3.Web3.toChecksumAddress('0x' + os.urandom(20).hex())
|
||||
t = api.balance(a, 'DUM')
|
||||
t.get()
|
||||
r = None
|
||||
for c in t.collect():
|
||||
r = c[1]
|
||||
assert t.successful()
|
||||
logg.debug(r)
|
||||
|
||||
assert r[0].get('balance_incoming') != None
|
||||
assert r[0].get('balance_outgoing') != None
|
||||
assert r[0].get('balance_network') != None
|
||||
|
||||
logg.debug('r {}'.format(r))
|
||||
Reference in New Issue
Block a user