def test_savings_account_creation(database_setup):
    conn = database_setup
    account_service = AccountService(conn=conn)

    customer = BaseCustomer("1111111111", 11111, "555-555-5555", "*****@*****.**")
    account_service.create_savings_account(customer=customer, rate=0.03)

    acct_id, customer_id, _, acct_type, acct_rate = conn.execute(
        "SELECT * FROM accounts"
    ).fetchall()[0]

    assert acct_type == 2
    assert acct_rate == 0.03
Example #2
0
    def open_savings_account(self, customer_id: Union[str, int],
                             deposit_amount: float,
                             savings_rate: float) -> SavingsAccount:
        """
        Opens a checking account for the customer associated with the ID passed in

        :param customer_id: ID of customer
        :param deposit_amount: Amount for initial account deposit
        :param savings_rate: Savings rate for account
        :return: Savings account created
        """
        account_service = AccountService(conn=self.conn)
        ledger_service = LedgerService(conn=self.conn)

        customer = self.get_customer_by_id(customer_id=customer_id)
        acct = account_service.create_savings_account(customer=customer,
                                                      rate=savings_rate)
        ledger_service.record_entry(account=acct, amount=deposit_amount)

        return acct