def test_get_balance(): """Test the balance is zero for a new account.""" fetch_api = FetchAIApi(**FETCHAI_TESTNET_CONFIG) fc = FetchAICrypto() balance = fetch_api.get_balance(fc.address) assert balance == 0, "New account has a positive balance." fc = FetchAICrypto(private_key_path=FETCHAI_PRIVATE_KEY_PATH) balance = fetch_api.get_balance(fc.address)
def test_get_balance(): """Test the balance is zero for a new account.""" fetchai_api = FetchAIApi(**FETCHAI_TESTNET_CONFIG) fc = FetchAICrypto() balance = fetchai_api.get_balance(fc.address) assert balance == 0, "New account has a positive balance." balance = get_wealth(fc.address) assert balance > 0, "Existing account has no balance."
def get_wealth(address: str): """Get wealth for test.""" fetchai_api = FetchAIApi(**FETCHAI_TESTNET_CONFIG) FetchAIFaucetApi().get_wealth(address) balance = 0 timeout = 0 while timeout < 40 and balance == 0: time.sleep(1) timeout += 1 _balance = fetchai_api.get_balance(address) balance = _balance if _balance is not None else 0 return balance