Allow empty proofs in token info task
This commit is contained in:
		
							parent
							
								
									8d571b51c5
								
							
						
					
					
						commit
						4b8eae41f7
					
				@ -17,7 +17,8 @@ from cic_eth.enum import LockEnum
 | 
			
		||||
 | 
			
		||||
app = celery.current_app
 | 
			
		||||
 | 
			
		||||
logg = logging.getLogger(__name__)
 | 
			
		||||
#logg = logging.getLogger(__name__)
 | 
			
		||||
logg = logging.getLogger()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Api(ApiBase):
 | 
			
		||||
@ -119,6 +120,7 @@ class Api(ApiBase):
 | 
			
		||||
            logg.debug('looking up tokens without external proof check: {}'.format(','.join(token_symbols)))
 | 
			
		||||
            proof = ''
 | 
			
		||||
 | 
			
		||||
        logg.debug('proof is {}'.format(proof))
 | 
			
		||||
        l = len(token_symbols)
 | 
			
		||||
        if len(proof) == 0:
 | 
			
		||||
            l = 0 
 | 
			
		||||
 | 
			
		||||
@ -491,6 +491,7 @@ def token_info(self, tokens, chain_spec_dict, proofs=[]):
 | 
			
		||||
 | 
			
		||||
        token_symbol_proof_hex = to_identifier(token_chain_object.symbol)
 | 
			
		||||
        token_proofs = [token_symbol_proof_hex]
 | 
			
		||||
        if len(proofs) > 0:
 | 
			
		||||
            token_proofs += proofs[i]
 | 
			
		||||
 | 
			
		||||
        tokens[i] = {
 | 
			
		||||
 | 
			
		||||
@ -110,7 +110,7 @@ def test_tokens_noproof(
 | 
			
		||||
        custodial_roles,
 | 
			
		||||
        foo_token_declaration,
 | 
			
		||||
        bar_token_declaration,
 | 
			
		||||
        celery_session_worker,
 | 
			
		||||
        celery_worker,
 | 
			
		||||
        ):
 | 
			
		||||
 | 
			
		||||
    api = Api(str(default_chain_spec), queue=None, callback_param='foo')     
 | 
			
		||||
@ -120,10 +120,10 @@ def test_tokens_noproof(
 | 
			
		||||
    assert len(r) == 1
 | 
			
		||||
    assert r[0]['address'] == strip_0x(foo_token)
 | 
			
		||||
 | 
			
		||||
    t = api.tokens(['FOO'], proof='')
 | 
			
		||||
    t = api.tokens(['BAR'], proof='')
 | 
			
		||||
    r = t.get()
 | 
			
		||||
    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)
 | 
			
		||||
    r = t.get()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user