示例#1
0
def test_maxi_savings_account():
    bank = Bank()
    checkingAccount = Account(MAXI_SAVINGS)
    bank.addCustomer(Customer("Bill").openAccount(checkingAccount))
    year_behind = datetime.datetime.now() - datetime.timedelta(365)
    checkingAccount.deposit(3000.0, year_behind)
    assert_equals(bank.totalInterestPaid(), 150.0)
def test_checking_account():
    bank = Bank()
    checkingAccount = Account(CHECKING)
    bill = Customer("Bill").openAccount(checkingAccount)
    bank.addCustomer(bill)
    checkingAccount.deposit(100.0)
    assert_equals(bank.totalInterestPaid(), 0.1 * DateProvider.getTotalDaysPassedRatio())
示例#3
0
def test_checking_account():
    bank = Bank()
    checkingAccount = Account(CHECKING)
    bill = Customer("Bill").openAccount(checkingAccount)
    bank.addCustomer(bill)
    checkingAccount.deposit(100.0)
    assert_equals(bank.totalInterestPaid(), 0.1)
def test_maxi_savings_account():
    bank = Bank()
    maxiSavingsAccount = Account(MAXI_SAVINGS)
    bank.addCustomer(Customer("Bill").openAccount(maxiSavingsAccount))
    maxiSavingsAccount.deposit(3000.0)
    assert_equals(maxiSavingsAccount.checkTransactionInLastTenDays(), True)
    assert_equals(3000 * 0.001 * DateProvider.getTotalDaysPassedRatio(), maxiSavingsAccount.interestEarned())
示例#5
0
def test_checking_account():
    bank = Bank()
    checkingAccount = Account(CHECKING)
    bill = Customer("Bill").openAccount(checkingAccount)
    bank.addCustomer(bill)
    year_behind = datetime.datetime.now() - datetime.timedelta(365)
    checkingAccount.deposit(100.0, year_behind)
    assert_equals(bank.totalInterestPaid(), 0.1)
示例#6
0
def test_maxi_savings_account_with_withdrawals():
    bank = Bank()
    checkingAccount = Account(MAXI_SAVINGS)
    bank.addCustomer(Customer("Bill").openAccount(checkingAccount))
    year_behind = datetime.datetime.now() - datetime.timedelta(365)
    five_days_behind = datetime.datetime.now() - datetime.timedelta(5)
    checkingAccount.deposit(3000.0, year_behind)
    checkingAccount.withdraw(1000.0, five_days_behind)
    assert_almost_equals(bank.totalInterestPaid(), 147.97, places=2)
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.)
def test_check_transaction_in_last_10_days():
    bank = Bank()
    maxiSavingsAccount = Account(MAXI_SAVINGS)
    bank.addCustomer(Customer("Bill").openAccount(maxiSavingsAccount))
    maxiSavingsAccount.deposit(3000.0)
    assert_equals(maxiSavingsAccount.transactions[0].amount, 3000)
    assert_equals(maxiSavingsAccount.transactions[0].transactionDate.year, DateProvider.now().year)
    assert_equals(maxiSavingsAccount.transactions[0].transactionDate.month, DateProvider.now().month)
    assert_equals(maxiSavingsAccount.transactions[0].transactionDate.day, DateProvider.now().day)
    assert_equals(maxiSavingsAccount.transactions[0].transactionDate >= DateProvider.tenDaysAgo(), True)
    assert_equals(maxiSavingsAccount.checkTransactionInLastTenDays(), True)
示例#9
0
    def open_account(self, account_type, initial_transaction_amount=0, initial_transaction_date = None):
        """

        :type initial_transaction_amount: float
        """
        account = Account(account_type)
        self.accounts.append(account)
        if initial_transaction_amount > 0:
            account.deposit(initial_transaction_amount, initial_transaction_date)
        elif initial_transaction_amount < 0:
            account.withdraw(-initial_transaction_amount, initial_transaction_date)
        return account
def test_statement():
    checkingAccount = Account(CHECKING)
    savingsAccount = Account(SAVINGS)
    henry = Customer("Henry").openAccount(checkingAccount).openAccount(savingsAccount)
    checkingAccount.deposit(100.0)
    savingsAccount.deposit(4000.0)
    savingsAccount.withdraw(200.0)
    assert_equals(henry.getStatement(),
                  "Statement for Henry" +
                  "\n\nChecking Account\n  deposit $100.00\nTotal $100.00" +
                  "\n\nSavings Account\n  deposit $4000.00\n  withdrawal $200.00\nTotal $3800.00" +
                  "\n\nTotal In All Accounts $3900.00")
def test_withdrawals():
    checkingAccount = Account(CHECKING)
    oscar = Customer("Oscar").openAccount(checkingAccount)
    checkingAccount.deposit(1000.0, datetime(2016, 4, 12))
    checkingAccount.deposit(1000.0, datetime(2016, 4, 15))
    checkingAccount.deposit(1000.0, datetime(2016, 4, 17))
    assert_almost_equals(oscar.totalInterestEarned(), 0.17, places=2)
    checkingAccount.withdraw(1000.0, datetime(2016, 4, 19))
    assert_almost_equals(oscar.totalInterestEarned(), 0.12, places=2)
def check_transfer_account():
    checkingAccount = Account(CHECKING)
    savingsAccount = Account(SAVINGS)
    henry = Customer("Henry").openAccount(checkingAccount).openAccount(savingsAccount)
    checkingAccount.deposit(100.0)
    savingsAccount.deposit(4000.0)
    savingsAccount.transfer(checkingAccount, 100)
    henry.getStatement()
    assert_equals(henry.getStatement(), 'Statement for Henry\n\n'
                                        'Checking Account\n  deposit $100.00\n '
                                        ' deposit $100.00\nTotal $200.00\n\nSavings Account\n '
                                        ' deposit $4000.00\n  withdrawal $100.00\nT'
                                        'otal $3900.00\n\nTotal In All Accounts $4100.00')
def test_maxi_savings_account():
    bank = Bank()
    maxiSavingsAccount = Account(MAXI_SAVINGS)
    bank.addCustomer(Customer("Bill").openAccount(maxiSavingsAccount))
    maxiSavingsAccount.deposit(3000.0)
    assert_equals(bank.totalInterestPaid(), maxiSavingsAccount.interestEarned())
def test_savings_account():
    bank = Bank()
    savingsAccount = Account(SAVINGS)
    bank.addCustomer(Customer("Bill").openAccount(savingsAccount))
    savingsAccount.deposit(1500.0)
    assert_equals(bank.totalInterestPaid(), savingsAccount.interestEarned())
示例#15
0
def test_maxi_savings_account():
    bank = Bank()
    checkingAccount = Account(MAXI_SAVINGS)
    bank.addCustomer(Customer("Bill").openAccount(checkingAccount))
    checkingAccount.deposit(3000.0)
    assert_equals(bank.totalInterestPaid(), 170.0)