Skip to content

Commit

Permalink
feat(dcu): Add basic unit testing; fix default filename.
Browse files Browse the repository at this point in the history
  • Loading branch information
hlieberman committed Dec 22, 2023
1 parent 1018f10 commit f33b4bb
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion beancount_reds_importers/importers/dcu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Importer(csvreader.Importer, banking.Importer):
def custom_init(self):
if not self.custom_init_run:
self.max_rounding_error = 0.04
self.filename_pattern_def = ".*Account Transactions"
self.filename_pattern_def = ".*Account_Transactions"
self.header_identifier = ""
self.column_labels_line = '"DATE","TRANSACTION TYPE","DESCRIPTION","AMOUNT","ID","MEMO","CURRENT BALANCE"'
self.date_format = "%m/%d/%Y"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"DATE","TRANSACTION TYPE","DESCRIPTION","AMOUNT","ID","MEMO","CURRENT BALANCE"
"12/31/2021","DEBIT","TRANSFER TO MBR ***0123 ACCT 4 MOBILE BANKING TRANSFER:123456789012345678 - SWEEP ACCOUNT","-$7,971.39","dwA4AEUAZQBKAGcAKwBGAG8ATwBQAEkAeQBiAHIAWAAvAGMAUwBVAFUAYgBzAG8AVwB2AEwAVwBNAGMARABQADQAVgBkAHcAVQA4AGkAQwA2AG8ARABTAGMAMQAxAEgAagBTAG8ANAB1ADAAcABuAFUAUwBsAHAAcQBZAFYAQgB4AFkAWABpADEARwBuAFcAcwBNADAAeQB5AGcAMgBBAFAARABFAFQARQBnAD0APQA","","$500.00"
"12/30/2021","CREDIT","ELECTRONIC DEPOSIT - 3392 ACME INC DDEPOSIT 123456","$6,000.36","VwB0AG0AeABFADMANQB6AHYASQA1AGwAUQBZAEIAUgBvAFUAZQBEAEsASgA4ADAAdgB0ADYAWgBrAHgAbwBZAFkAWQBCAE4AdQArAGQAZABwAEYAZwA4AEkAdQB5AFQAbAByAHUARgBJAGoAcQBNADUAOABGADUAQgBlAHkAKwBpAHoAVQByAGsAYwBwAHgANQByADAATQBoAHIAUQBSADYASgAvAHkAegBRAD0APQA","","$8,471.39"
"12/29/2021","CREDIT","ELECTRONIC DEPOSIT - 3392 ACME INC DDEPOSIT 123456","$256.00","VwBuAHAAUABxAHYAeQBSAFIANgB3ADgANQB6ADYAagB4ADcATwBtAHIAeQBjAEYAdQA1AGMAdwB3AE0AWQA0AHcANgBoAGUASABqAFYAVQBSAGEAdwBIAFYAeQBlAG8AWABKAHUAVwBNAGQARwAvAGgAUQBJAHUAbQBuAGIAYgBpAHIAZAB2AFQAVgA4AHMATQBVAHMAbQBGADQAbgAvAHQAWAA2ADIAVwBnAD0APQA","","$2,471.03"
"12/28/2021","DEBIT","TRANSFER TO MBR ***0123 ACCT 4 12/31/2021 03:24 348604. ROAD RUNNER PAYMENT - SWEEP ACCOUNT","-$50.50","LwBzADgAeABnAGsAbwBVAFAAYgBQADkAMgBRAGoAZgBHADkATwBXAHYAZgBYAFoAMwBKAGIASgBTAHoAdgB0AGsAUQA5AHEASwArAHoAZwBlAFUAdwBSAGcAbwA3AHQARwA3AFMATgBwAHQAagA3ADkAYQBzAFYAUABDAFUAMwBZAEYAOQBKAHIATAAyAEUAbABmAGwAcAB0AHcAZQBnAGsAawAxAEIANgBRAD0APQA","","$2,215.03"
"12/27/2021","CREDIT","ELECTRONIC DEPOSIT - ACME INCEXPENSIFY 000000","$25.00","VQAxAE8AdwA3ADcAdQB6AGgAawBOAFcAVwA3AG0AKwBRAFYAUgBPAGQATAByAC8ANABwAEYATQBMAHEAbwA3AFoAZgBFAFUARABaAFUAcABuAFcAcgBVAGgAUQA0ADkARgB4AFAAOAArAHIAZAArAHAATABTAEgAMQByADQATwByADYAZgA3AGEASwAyAGkAawBBAEYAeQBCAC8AeQAzAHQAZQBDAGgAYgB3AD0APQA","","$2,265.53"
"12/26/2021","CREDIT","ELECTRONIC DEPOSIT - RANDOMCORP RECEIVABLE","$141.67","aQBoAHgATgBGAHgAZABTAEcAUwB1AEIAVQBoAE4AYQBBAHUAbQBHAHoASgBsADUAQwBLAGsAaABHAHEAUgBRAGcATQBzAFcAMgBCAGIAKwBQAGMALwBaAGwAZABuAGkANABpAGoAUQBRAG4AWQB4AFYATgBqAFAAeQBaAE0AbQB6ADMALwB6AGoAMwBsAFUAeQBrAHYAMgB3AEwAbwAzADAAMwAwADAATAB3AD0APQA","","$2,240.53"
"12/25/2021","DEBIT","TRANSFER TO MBR ***0123 ACCT 4 12/22/2021 15:32 170124. - SWEEP ACCOUNT","-$2,500.99","dwBPAGUAcwBnAGUAVwBaAHgAUwArADgANQBQADcAWAAxADYAdgBCAGEAYgBqAFkAUwBZAG8AeQA5AGwAbwBoAGoAMQBYAEcAcwBPAFYAZgB1AEEAcAB1AEgATQB3AE8AOABhAEoATwBWAEoASQBqAFcAWAA0ADQAMQBsAGEATABZAFEAagBEAEgAMQBIAHcAdwB5AHQARABCAEsAWAAxAEcAMwB4AFEAVgBRAD0APQA","","$2,098.86"
"12/20/2021","DEBIT","TRANSFER TO MBR ***0123 ACCT 4 12/16/2021 21:32 51592. - SWEEP ACCOUNT","-$400.15","cwBBAFgAcQBTACsANgBlAGUAegBpADMARABjAEgAMwBTAGcAMgB6AHIATQAxAEsAQgAwADUAQwA3AHgAWAB4AFgAWAA1AEcAbgA4ADYARAByADQAQgBpAE8AKwBPAHAARABWAEkAMAA0AFMAaQBKADQAegBVADIATgA4ADkAdAB1AHoAdgA4AE4ARQBtAGUASgBGAG8AYgBiAHYAMgBqAE0AMwBYADUAbABRAD0APQA","","$4,599.85"
"12/18/2021","DEBIT","TRANSFER TO MBR ***0123 ACCT 3 12/16/2021 21:28 51547. - MONEY MARKET","-$5,000.00","cABXAGwATgBGADgAUgBmAG8AWgBaAC8AaQB1AC8AbgBMAEsARQB4AGcAcQBNAG8AYwBoADgAQgAwAFYAYwBJADIASwBQAGYAZwA2AHoAUgBJADIANABuAFcASwA0AEQAdQBpAHMANwBSAGkAVgBpAHAAVABkADgAUQAvACsAZwBMAHkAaQAyADMAVABwAGwAVQA2AEMAcwBMADAAZgB0AGgAYgBvAG4AZgBRAD0APQA","","$5,000.00"
"12/15/2021","CREDIT","ELECTRONIC DEPOSIT - 3392 ACME INC DDEPOSIT 121521","$10,000.00","egBHAFMATQBCAGwAeABlAGoAdgBlAHMALwA1AEwAVgA3AFMAVgBJAEgANgBnADEAcwBYAG8AegBYAFQARQBrAEMAMQA2AHYAMABLADgAQwBzAFAARABEAGsANABIAGwAKwBWAEwAYwBuAEsALwBBAHgAUQBUAGwANABIAHYATABrAEQAegBtAEQARABHADgARwBvAFMAMQBDAGMAdQBwAFUATwA2ADQASABnAD0APQA","","$10,000.00"
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
2021-12-15 * "ELECTRONIC DEPOSIT - 3392 ACME INC DDEPOSIT 121521"
Assets:Banks:DCU:Checking 10000.00 USD

2021-12-18 * "TRANSFER TO MBR ***0123 ACCT 3 12/16/2021 21:28 51547. - MONEY MARKET"
Assets:Banks:DCU:Checking -5000.00 USD

2021-12-20 * "TRANSFER TO MBR ***0123 ACCT 4 12/16/2021 21:32 51592. - SWEEP ACCOUNT"
Assets:Banks:DCU:Checking -400.15 USD

2021-12-25 * "TRANSFER TO MBR ***0123 ACCT 4 12/22/2021 15:32 170124. - SWEEP ACCOUNT"
Assets:Banks:DCU:Checking -2500.99 USD

2021-12-26 * "ELECTRONIC DEPOSIT - RANDOMCORP RECEIVABLE"
Assets:Banks:DCU:Checking 141.67 USD

2021-12-27 * "ELECTRONIC DEPOSIT - ACME INCEXPENSIFY 000000"
Assets:Banks:DCU:Checking 25.00 USD

2021-12-28 * "TRANSFER TO MBR ***0123 ACCT 4 12/31/2021 03:24 348604. ROAD RUNNER PAYMENT - SWEEP ACCOUNT"
Assets:Banks:DCU:Checking -50.50 USD

2021-12-29 * "ELECTRONIC DEPOSIT - 3392 ACME INC DDEPOSIT 123456"
Assets:Banks:DCU:Checking 256.00 USD

2021-12-30 * "ELECTRONIC DEPOSIT - 3392 ACME INC DDEPOSIT 123456"
Assets:Banks:DCU:Checking 6000.36 USD

2021-12-31 * "TRANSFER TO MBR ***0123 ACCT 4 MOBILE BANKING TRANSFER:123456789012345678 - SWEEP ACCOUNT"
Assets:Banks:DCU:Checking -7971.39 USD

2022-01-01 balance Assets:Banks:DCU:Checking 500.00 USD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Assets:Banks:DCU:Checking
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-12-31
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Main_Checking_Account_Transactions.csv
18 changes: 18 additions & 0 deletions beancount_reds_importers/importers/dcu/tests/dcu_csv_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3

from os import path
from beancount.ingest import regression_pytest as regtest
from beancount_reds_importers.importers import dcu


@regtest.with_importer(
dcu.Importer(
{
"main_account": "Assets:Banks:DCU:Checking",
"currency": "USD",
}
)
)
@regtest.with_testdir(path.dirname(__file__))
class TestDCUCSV(regtest.ImporterTestBase):
pass

0 comments on commit f33b4bb

Please sign in to comment.