def test_transferAmountBelowZero(): checkingAccount = Account(CHECKING) savingsAccount = Account(SAVINGS) oscar = Customer("Oscar").openAccount(checkingAccount) oscar.openAccount(savingsAccount) try: oscar.transfer(checkingAccount, savingsAccount, -1) except ValueError as e: result = str(e) assert_equals(result, 'Incorrect amount, should be more than 0')
def test_transferNotEnoughFunds(): checkingAccount = Account(CHECKING) savingsAccount = Account(SAVINGS) oscar = Customer("Oscar").openAccount(checkingAccount) oscar.openAccount(savingsAccount) try: oscar.transfer(savingsAccount, savingsAccount, 10) except ValueError as e: result = str(e) assert_equals(result, 'Incorrect amount, should be more than ' 'source account amount')
def test_transferAmount(): checkingAccount = Account(CHECKING) savingsAccount = Account(SAVINGS) oscar = Customer("Oscar").openAccount(checkingAccount) oscar.openAccount(savingsAccount) checkingAccount.deposit(100.0) transfered = oscar.transfer(checkingAccount, savingsAccount, 10) assert_equals(transfered, True) assert_equals(savingsAccount.amount, 10.)