Skip to content

Commit

Permalink
issue #105 - WIP migrating queries for BudgetTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
jantman committed Feb 18, 2018
1 parent 5f220ea commit 39936c3
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 19 deletions.
16 changes: 14 additions & 2 deletions biweeklybudget/tests/acceptance/flaskapp/views/test_budgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,10 @@ def test_3_verify_db(self, testdb):
assert t1.notes == 'Budget Transfer Notes'
assert t1.account_id == 1
assert t1.scheduled_trans_id is None
assert t1.budget_id == 2
assert t1.planned_budget_id == 2
assert len(t1.budget_transactions) == 1
assert t1.budget_transactions[0].budget_id == 2
assert float(t1.budget_transactions[0].amount) == 123.45
rec1 = testdb.query(TxnReconcile).get(2)
assert rec1.txn_id == 4
assert rec1.ofx_fitid is None
Expand All @@ -722,6 +725,9 @@ def test_3_verify_db(self, testdb):
assert t2.account_id == 1
assert t2.scheduled_trans_id is None
assert t2.budget_id == 5
assert len(t2.budget_transactions) == 1
assert t2.budget_transactions[0].budget_id == 5
assert float(t2.budget_transactions[0].amount) == -123.45
rec2 = testdb.query(TxnReconcile).get(3)
assert rec2.txn_id == 5
assert rec2.ofx_fitid is None
Expand Down Expand Up @@ -866,7 +872,10 @@ def test_3_verify_db(self, testdb):
assert t1.notes == 'Budget Transfer Notes'
assert t1.account_id == 1
assert t1.scheduled_trans_id is None
assert t1.budget_id == 5
assert t1.planned_budget_id == 5
assert len(t1.budget_transactions) == 1
assert t1.budget_transactions[0].budget_id == 5
assert float(t1.budget_transactions[0].amount) == 123.45
rec1 = testdb.query(TxnReconcile).get(2)
assert rec1.txn_id == 4
assert rec1.ofx_fitid is None
Expand All @@ -881,6 +890,9 @@ def test_3_verify_db(self, testdb):
assert t2.account_id == 1
assert t2.scheduled_trans_id is None
assert t2.budget_id == 2
assert len(t2.budget_transactions) == 1
assert t2.budget_transactions[0].budget_id == 2
assert float(t2.budget_transactions[0].amount) == -123.45
rec2 = testdb.query(TxnReconcile).get(3)
assert rec2.txn_id == 5
assert rec2.ofx_fitid is None
Expand Down
5 changes: 4 additions & 1 deletion biweeklybudget/tests/acceptance/flaskapp/views/test_fuel.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,5 +694,8 @@ def test_15_fuel_verify_db(self, testdb):
assert trans.description == 'Fill Location2 - FuelFill #8 (Veh1)'
assert trans.notes == 'My Notes2'
assert trans.account_id == 3
assert trans.budget_id == 1
assert trans.planned_budget_id is None
assert trans.scheduled_trans_id is None
assert len(trans.budget_transactions) == 1
assert trans.budget_transactions[0].budget_id == 1
assert float(trans.budget_transactions[0].amount) == 14.82
43 changes: 35 additions & 8 deletions biweeklybudget/tests/acceptance/flaskapp/views/test_payperiods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,12 @@ def test_10_transaction_modal_verify_db(self, testdb):
assert float(t.actual_amount) == 111.13
assert float(t.budgeted_amount) == 111.11
assert t.account_id == 1
assert t.budget_id == 1
assert t.planned_budget_id == 1
assert t.scheduled_trans_id == 1
assert t.notes == 'notesT1'
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 1
assert float(t.budget_transactions[0].amount) == 111.13

def test_11_sched_trans_verify_db(self, testdb):
t = testdb.query(ScheduledTransaction).get(7)
Expand Down Expand Up @@ -1395,11 +1398,15 @@ def test_21_issue152_verify_db(self, testdb):
t1 = testdb.query(Transaction).get(8)
assert t1.date == (dtnow() - timedelta(days=2)).date()
assert float(t1.actual_amount) == 100.00
assert t1.budgeted_amount is None
assert t1.description == 'issue152regression1'
assert t1.notes == 'regression test #1 for issue #152'
assert t1.account_id == 1
assert t1.scheduled_trans_id is None
assert t1.budget_id == 2
assert t1.planned_budget_id is None
assert len(t1.budget_transactions) == 1
assert t1.budget_transactions[0].budget_id == 2
assert float(t1.budget_transactions[0].amount) == 100.00

def test_22_issue152_info_panels(self, base_url, selenium):
"""verify pay period totals"""
Expand Down Expand Up @@ -1546,11 +1553,15 @@ def test_30_issue152_inactive_budget(self, testdb):
t1 = testdb.query(Transaction).get(9)
assert t1.date == (dtnow() - timedelta(days=1)).date()
assert float(t1.actual_amount) == 200.00
assert t1.budgeted_amount is None
assert t1.description == 'issue152regression3'
assert t1.notes == 'issue #152 regression test #3'
assert t1.account_id == 1
assert t1.scheduled_trans_id is None
assert t1.budget_id == 3
assert t1.planned_budget_id is None
assert len(t1.budget_transactions) == 1
assert t1.budget_transactions[0].budget_id == 3
assert float(t1.budget_transactions[0].amount) == 200.00

def test_31_issue152_edit_inactive(self, base_url, selenium):
self.get(
Expand Down Expand Up @@ -1590,11 +1601,15 @@ def test_32_issue152_verify_db(self, testdb):
t1 = testdb.query(Transaction).get(9)
assert t1.date == (dtnow() - timedelta(days=1)).date()
assert float(t1.actual_amount) == 200.00
assert t1.budgeted_amount is None
assert t1.description == 'issue152regression3-edited'
assert t1.notes == 'issue #152 regression test #3'
assert t1.account_id == 1
assert t1.scheduled_trans_id is None
assert t1.budget_id == 3
assert t1.planned_budget_id is None
assert len(t1.budget_transactions) == 1
assert t1.budget_transactions[0].budget_id == 3
assert float(t1.budget_transactions[0].amount) == 200.00

def test_40_issue161_info_panels(self, base_url, selenium):
"""verify pay period totals"""
Expand Down Expand Up @@ -1883,9 +1898,12 @@ def test_06_verify_db(self, testdb):
assert float(t.actual_amount) == 22.22
assert float(t.budgeted_amount) == 11.11
assert t.account_id == 1
assert t.budget_id == 1
assert t.planned_budget_id == 1
assert t.scheduled_trans_id == 7
assert t.notes == 'T4notes'
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 1
assert float(t.budget_transactions[0].amount) == 22.22


@pytest.mark.acceptance
Expand Down Expand Up @@ -2273,7 +2291,10 @@ def test_10_verify_db(self, testdb):
assert t1.notes == 'Budget Transfer Notes'
assert t1.account_id == 1
assert t1.scheduled_trans_id is None
assert t1.budget_id == 2
assert t1.planned_budget_id == 2
assert len(t1.budget_transactions) == 1
assert t1.budget_transactions[0].budget_id == 2
assert float(t1.budget_transactions[0].amount) == 123.45
rec1 = testdb.query(TxnReconcile).get(3)
assert rec1.txn_id == 8
assert rec1.ofx_fitid is None
Expand All @@ -2287,7 +2308,10 @@ def test_10_verify_db(self, testdb):
assert t2.notes == 'Budget Transfer Notes'
assert t2.account_id == 1
assert t2.scheduled_trans_id is None
assert t2.budget_id == 5
assert t2.planned_budget_id == 5
assert len(t1.budget_transactions) == 1
assert t1.budget_transactions[0].budget_id == 5
assert float(t1.budget_transactions[0].amount) == -123.45
rec2 = testdb.query(TxnReconcile).get(4)
assert rec2.txn_id == 9
assert rec2.ofx_fitid is None
Expand Down Expand Up @@ -2910,7 +2934,10 @@ def test_10_verify_db(self, testdb):
assert t1.notes == 'Skip Notes'
assert t1.account_id == 1
assert t1.scheduled_trans_id == 8
assert t1.budget_id == 1
assert t1.planned_budget_id == 1
assert len(t1.budget_transactions) == 1
assert t1.budget_transactions[0].budget_id == 1
assert float(t1.budget_transactions[0].amount) == 0.0
rec1 = testdb.query(TxnReconcile).get(3)
assert rec1.txn_id == 8
assert rec1.ofx_fitid is None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,10 @@ def test_06_verify_db(self, testdb):
assert t.date == date(2017, 4, 10)
assert float(t.actual_amount) == -100.00
assert t.account_id == 1
assert t.budget_id == 1
assert t.planned_budget_id is None
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 1
assert float(t.budget_transactions[0].amount) == -100.00

def test_07_edit(self, base_url, selenium):
self.baseurl = base_url
Expand Down Expand Up @@ -1692,8 +1695,10 @@ def test_10_verify_db_transaction(self, testdb):
assert res[1].date == date(2017, 4, 11)
assert float(res[1].actual_amount) == -251.23
assert res[1].description == 'ofx2-trans1'
assert res[1].budget_id == 2
assert res[1].notes == 'created from OFXTransaction(2, OFX2)foo'
assert len(res[1].budget_transactions) == 1
assert res[1].budget_transactions[0].budget_id == 2
assert float(res[1].budget_transactions[0].amount) == -251.23


@pytest.mark.acceptance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,13 @@ def test_0_verify_db(self, testdb):
assert t.date == (dtnow() - timedelta(days=2)).date()
assert float(t.actual_amount) == 222.22
assert t.budgeted_amount is None
assert t.planned_budget_id is None
assert t.account_id == 3
assert t.budget_id == 2
assert t.scheduled_trans_id is None
assert t.notes == 'notesT3'
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 2
assert float(t.budget_transactions[0].amount) == 222.22

def test_1_modal(self, base_url, selenium):
self.baseurl = base_url
Expand Down Expand Up @@ -359,10 +362,13 @@ def test_00_simple_modal_verify_db(self, testdb):
assert t.date == dtnow().date()
assert float(t.actual_amount) == -333.33
assert float(t.budgeted_amount) == -333.33
assert t.planned_budget_id == 4
assert t.account_id == 2
assert t.budget_id == 4
assert t.scheduled_trans_id == 3
assert t.notes == 'notesT2'
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 4
assert float(t.budget_transactions[0].amount) == -333.33
assert testdb.query(Budget).get(4).current_balance == Decimal('1284.23')
assert testdb.query(Budget).get(5).current_balance == Decimal('9482.29')

Expand Down Expand Up @@ -466,9 +472,12 @@ def test_03_simple_modal_verify_db(self, testdb):
assert float(t.actual_amount) == -123.45
assert float(t.budgeted_amount) == -333.33
assert t.account_id == 4
assert t.budget_id == 5
assert t.planned_budget_id == 5
assert t.scheduled_trans_id == 3
assert t.notes == 'notesT2edited'
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 5
assert float(t.budget_transactions[0].amount) == -123.45
assert testdb.query(Budget).get(4).current_balance == Decimal('1074.35')
assert testdb.query(Budget).get(5).current_balance == Decimal('9482.29')

Expand All @@ -480,9 +489,12 @@ def test_10_cant_edit_reconciled_verify_db(self, testdb):
assert float(t.actual_amount) == 111.13
assert float(t.budgeted_amount) == 111.11
assert t.account_id == 1
assert t.budget_id == 1
assert t.planned_budget_id == 1
assert t.scheduled_trans_id == 1
assert t.notes == 'notesT1'
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 1
assert float(t.budget_transactions[0].amount) == 111.13

def test_11_cant_edit_reconciled_modal_on_click(self, base_url, selenium):
self.baseurl = base_url
Expand Down Expand Up @@ -614,9 +626,12 @@ def test_23_modal_add_verify_db(self, testdb):
assert float(t.actual_amount) == 123.45
assert t.budgeted_amount is None
assert t.account_id == 1
assert t.budget_id == 2
assert t.planned_budget_id is None
assert t.scheduled_trans_id is None
assert t.notes == 'NewTransNotes'
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 2
assert float(t.budget_transactions[0].amount) == 123.45

def test_31_verify_index_budgets_table(self, base_url, selenium):
self.get(selenium, base_url + '/')
Expand Down Expand Up @@ -678,9 +693,12 @@ def test_33_verify_db(self, testdb):
assert float(t.actual_amount) == 345.67
assert t.budgeted_amount is None
assert t.account_id == 1
assert t.budget_id == 5
assert t.planned_budget_id is None
assert t.scheduled_trans_id is None
assert t.notes == 'NewTransNotes'
assert len(t.budget_transactions) == 1
assert t.budget_transactions[0].budget_id == 5
assert float(t.budget_transactions[0].amount) == 345.67

def test_34_verify_index_budgets_table(self, base_url, selenium):
self.get(selenium, base_url + '/')
Expand Down

0 comments on commit 39936c3

Please sign in to comment.