PatrickAlphaC / brownie_fund_me

26 stars 64 forks source link

Error in brownie test #23

Closed Swapnamoy45 closed 2 years ago

Swapnamoy45 commented 2 years ago

As explained by Patrick, we need to close the Ganache-UI before writing brownie test in the terminal. So did I keeping everything same.....and got a massive error for some reason where the main error message was: ValueError: sender doesn't have enough funds to send tx. The upfront cost is: 25000000000000000 and the sender's account only has: 0

Error screen part 1: image Error screen part 2: image

My test_fund_me.py code (until now) looks like this:

from scripts.helpful_scripts import get_account
from scripts.deploy import deploy_fund_me
import pytest

def test_fund_and_withdraw():
    account = get_account()
    fund_me = deploy_fund_me()
    entrance_fee = fund_me.getEntranceFee()
    tx1 = fund_me.fund({"from": account, "value": entrance_fee})
    tx1.wait(1)
    assert fund_me.addressToAmountFunded(account.address) == entrance_fee
    tx2 = fund_me.withdraw({"from": account})
    tx2.wait(1)
    assert fund_me.addressToAmountFunded(account.address) == 0

I'm a complete newbie in this field and thus have very limited knowledge about it.

Thanks in advance

Swapnamoy45 commented 2 years ago

@PatrickAlphaC Basically when I'm trying to run fund_and_withdraw.py in the development network, it is finding another error : IndexError: list index out of range. This is really troubling me a lot. Your help would be appreciated.

PatrickAlphaC commented 2 years ago

Could you please post here: https://github.com/smartcontractkit/full-blockchain-solidity-course-py

Thank you!