def testThatAnEmptyTransactionIsValid(self): t = Transaction() self.assertEquals('', t.payee) self.assertEquals('', t.type) self.assertEquals(None, t.date) self.assertEquals(None, t.amount) self.assertEquals('', t.id) self.assertEquals('', t.memo)
def add_transaction_from_row(self, row): # 0 2 4 5 6 # posted,,05/28/2020,,PAYEE,BankTransType,--21.73 # note that deposits are double-negative transaction = Transaction() if row[6].startswith("--"): # deposit transaction.amount = float(row[6][2:]) else: transaction.amount = float(row[6]) transaction.date = convert_csv_date_to_ofx_date(row[2]) self.adjust_start_end_dates(transaction.date) # transaction id is prepended with the date, and then a uniqueness counter per day for that account transaction.id = "{}120000".format(transaction.date.format("YYYYMMDD")) + str(self._get_and_increment_transaction_counter(transaction.date)).zfill(7) transaction.payee = row[4] self.account.statement.transactions.append(transaction)
def _get_test_transactions(): transaction = Transaction() transaction.payee = 'Test' transaction.date = datetime.datetime.now() transaction.amount = 10.00 return [transaction]