Allow empty proofs in token info task

This commit is contained in:
nolash 2021-10-14 12:22:41 +02:00
parent 8d571b51c5
commit 4b8eae41f7
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 8 additions and 5 deletions

View File

@ -17,7 +17,8 @@ from cic_eth.enum import LockEnum
app = celery.current_app app = celery.current_app
logg = logging.getLogger(__name__) #logg = logging.getLogger(__name__)
logg = logging.getLogger()
class Api(ApiBase): class Api(ApiBase):
@ -119,6 +120,7 @@ class Api(ApiBase):
logg.debug('looking up tokens without external proof check: {}'.format(','.join(token_symbols))) logg.debug('looking up tokens without external proof check: {}'.format(','.join(token_symbols)))
proof = '' proof = ''
logg.debug('proof is {}'.format(proof))
l = len(token_symbols) l = len(token_symbols)
if len(proof) == 0: if len(proof) == 0:
l = 0 l = 0

View File

@ -491,7 +491,8 @@ def token_info(self, tokens, chain_spec_dict, proofs=[]):
token_symbol_proof_hex = to_identifier(token_chain_object.symbol) token_symbol_proof_hex = to_identifier(token_chain_object.symbol)
token_proofs = [token_symbol_proof_hex] token_proofs = [token_symbol_proof_hex]
token_proofs += proofs[i] if len(proofs) > 0:
token_proofs += proofs[i]
tokens[i] = { tokens[i] = {
'decimals': token_chain_object.decimals, 'decimals': token_chain_object.decimals,

View File

@ -110,7 +110,7 @@ def test_tokens_noproof(
custodial_roles, custodial_roles,
foo_token_declaration, foo_token_declaration,
bar_token_declaration, bar_token_declaration,
celery_session_worker, celery_worker,
): ):
api = Api(str(default_chain_spec), queue=None, callback_param='foo') api = Api(str(default_chain_spec), queue=None, callback_param='foo')
@ -120,10 +120,10 @@ def test_tokens_noproof(
assert len(r) == 1 assert len(r) == 1
assert r[0]['address'] == strip_0x(foo_token) assert r[0]['address'] == strip_0x(foo_token)
t = api.tokens(['FOO'], proof='') t = api.tokens(['BAR'], proof='')
r = t.get() r = t.get()
assert len(r) == 1 assert len(r) == 1
assert r[0]['address'] == strip_0x(foo_token) assert r[0]['address'] == strip_0x(bar_token)
t = api.tokens(['FOO'], proof=None) t = api.tokens(['FOO'], proof=None)
r = t.get() r = t.get()