diff --git a/biweeklybudget/tests/acceptance/flaskapp/views/test_budgets.py b/biweeklybudget/tests/acceptance/flaskapp/views/test_budgets.py index 41826f26..6c32d6a0 100644 --- a/biweeklybudget/tests/acceptance/flaskapp/views/test_budgets.py +++ b/biweeklybudget/tests/acceptance/flaskapp/views/test_budgets.py @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/biweeklybudget/tests/acceptance/flaskapp/views/test_fuel.py b/biweeklybudget/tests/acceptance/flaskapp/views/test_fuel.py index ab3c06ad..0fb5de3a 100644 --- a/biweeklybudget/tests/acceptance/flaskapp/views/test_fuel.py +++ b/biweeklybudget/tests/acceptance/flaskapp/views/test_fuel.py @@ -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 diff --git a/biweeklybudget/tests/acceptance/flaskapp/views/test_payperiods.py b/biweeklybudget/tests/acceptance/flaskapp/views/test_payperiods.py index 9f2a5f8e..9cb267ca 100644 --- a/biweeklybudget/tests/acceptance/flaskapp/views/test_payperiods.py +++ b/biweeklybudget/tests/acceptance/flaskapp/views/test_payperiods.py @@ -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) @@ -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""" @@ -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( @@ -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""" @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/biweeklybudget/tests/acceptance/flaskapp/views/test_reconcile.py b/biweeklybudget/tests/acceptance/flaskapp/views/test_reconcile.py index d01973cb..1fa08a96 100644 --- a/biweeklybudget/tests/acceptance/flaskapp/views/test_reconcile.py +++ b/biweeklybudget/tests/acceptance/flaskapp/views/test_reconcile.py @@ -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 @@ -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 diff --git a/biweeklybudget/tests/acceptance/flaskapp/views/test_transactions.py b/biweeklybudget/tests/acceptance/flaskapp/views/test_transactions.py index 9a18b5ab..ad6dbad0 100644 --- a/biweeklybudget/tests/acceptance/flaskapp/views/test_transactions.py +++ b/biweeklybudget/tests/acceptance/flaskapp/views/test_transactions.py @@ -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 @@ -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') @@ -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') @@ -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 @@ -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 + '/') @@ -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 + '/')