def test_get_balance(): """Test the balance is zero for a new account.""" cosmos_api = CosmosApi(**COSMOS_TESTNET_CONFIG) cc = CosmosCrypto() balance = cosmos_api.get_balance(cc.address) assert balance == 0, "New account has a positive balance." cc = CosmosCrypto(private_key_path=COSMOS_PRIVATE_KEY_PATH) balance = cosmos_api.get_balance(cc.address) assert balance > 0, "Existing account has no balance."
def test_get_balance(): """Test the balance is zero for a new account.""" cosmos_api = CosmosApi(**COSMOS_TESTNET_CONFIG) cc = CosmosCrypto() balance = cosmos_api.get_balance(cc.address) assert balance == 0, "New account has a positive balance." balance = get_wealth(cc.address) assert balance > 0, "Existing account has no balance."
def get_wealth(address: str): """Get wealth for test.""" cosmos_api = CosmosApi(**COSMOS_TESTNET_CONFIG) CosmosFaucetApi().get_wealth(address) balance = 0 timeout = 0 while timeout < 40 and balance == 0: time.sleep(1) timeout += 1 _balance = cosmos_api.get_balance(address) balance = _balance if _balance is not None else 0 return balance