Skip to content

Commit

Permalink
issue #178 - add a budget-split Transaction to sampledata and update …
Browse files Browse the repository at this point in the history
…all acceptance tests accordingly
  • Loading branch information
jantman committed Mar 11, 2018
1 parent 18de6b5 commit 09e6d5c
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_credit_table(self, selenium):
assert self.tbody2textlist(table) == [
[
'CreditOne', '-$952.06 (13 hours ago)', '$2,000.00',
'$1,047.94', '$222.22', '$825.72'
'$1,047.94', '$544.54', '$503.40'
],
[
'CreditTwo', '-$5,498.65 (a day ago)', '$5,500.00', '$1.35',
Expand Down
24 changes: 12 additions & 12 deletions biweeklybudget/tests/acceptance/flaskapp/views/test_budgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def test_1_verify_db(self, testdb):
max_t = max([
t.id for t in testdb.query(Transaction).all()
])
assert max_t == 3
assert max_t == 4
max_r = max([
t.id for t in testdb.query(TxnReconcile).all()
])
Expand Down Expand Up @@ -684,7 +684,7 @@ def test_2_transfer_modal(self, base_url, selenium):
_, _, body = self.get_modal_parts(selenium)
x = body.find_elements_by_tag_name('div')[0]
assert 'alert-success' in x.get_attribute('class')
assert x.text.strip() == 'Successfully saved Transactions 4 and 5' \
assert x.text.strip() == 'Successfully saved Transactions 5 and 6' \
' in database.'
# dismiss the modal
selenium.find_element_by_id('modalCloseButton').click()
Expand All @@ -700,7 +700,7 @@ def test_2_transfer_modal(self, base_url, selenium):

def test_3_verify_db(self, testdb):
desc = 'Budget Transfer - 123.45 from Periodic2 (2) to Standing2 (5)'
t1 = testdb.query(Transaction).get(4)
t1 = testdb.query(Transaction).get(5)
assert t1.date == dtnow().date()
assert t1.actual_amount == Decimal('123.45')
assert t1.budgeted_amount == Decimal('123.45')
Expand All @@ -712,11 +712,11 @@ def test_3_verify_db(self, testdb):
assert t1.budget_transactions[0].budget_id == 2
assert t1.budget_transactions[0].amount == Decimal('123.45')
rec1 = testdb.query(TxnReconcile).get(2)
assert rec1.txn_id == 4
assert rec1.txn_id == 5
assert rec1.ofx_fitid is None
assert rec1.ofx_account_id is None
assert rec1.note == desc
t2 = testdb.query(Transaction).get(5)
t2 = testdb.query(Transaction).get(6)
assert t2.date == dtnow().date()
assert t2.actual_amount == Decimal('-123.45')
assert t2.budgeted_amount == Decimal('-123.45')
Expand All @@ -728,7 +728,7 @@ def test_3_verify_db(self, testdb):
assert t2.budget_transactions[0].budget_id == 5
assert t2.budget_transactions[0].amount == Decimal('-123.45')
rec2 = testdb.query(TxnReconcile).get(3)
assert rec2.txn_id == 5
assert rec2.txn_id == 6
assert rec2.ofx_fitid is None
assert rec2.ofx_account_id is None
assert rec2.note == desc
Expand All @@ -743,7 +743,7 @@ def test_1_verify_db(self, testdb):
max_t = max([
t.id for t in testdb.query(Transaction).all()
])
assert max_t == 3
assert max_t == 4
max_r = max([
t.id for t in testdb.query(TxnReconcile).all()
])
Expand Down Expand Up @@ -838,7 +838,7 @@ def test_2_transfer_modal(self, base_url, selenium, testdb):
_, _, body = self.get_modal_parts(selenium)
x = body.find_elements_by_tag_name('div')[0]
assert 'alert-success' in x.get_attribute('class')
assert x.text.strip() == 'Successfully saved Transactions 4 and 5' \
assert x.text.strip() == 'Successfully saved Transactions 5 and 6' \
' in database.'
# dismiss the modal
selenium.find_element_by_id('modalCloseButton').click()
Expand All @@ -862,7 +862,7 @@ def test_3_verify_db(self, testdb):
assert pp.budget_sums[2]['spent'] == Decimal('98.77')
assert pp.budget_sums[2]['trans_total'] == Decimal('98.77')
desc = 'Budget Transfer - 123.45 from Standing2 (5) to Periodic2 (2)'
t1 = testdb.query(Transaction).get(4)
t1 = testdb.query(Transaction).get(5)
assert t1.date == dtnow().date()
assert t1.actual_amount == Decimal('123.45')
assert t1.budgeted_amount == Decimal('123.45')
Expand All @@ -874,11 +874,11 @@ def test_3_verify_db(self, testdb):
assert t1.budget_transactions[0].budget_id == 5
assert t1.budget_transactions[0].amount == Decimal('123.45')
rec1 = testdb.query(TxnReconcile).get(2)
assert rec1.txn_id == 4
assert rec1.txn_id == 5
assert rec1.ofx_fitid is None
assert rec1.ofx_account_id is None
assert rec1.note == desc
t2 = testdb.query(Transaction).get(5)
t2 = testdb.query(Transaction).get(6)
assert t2.date == dtnow().date()
assert t2.actual_amount == Decimal('-123.45')
assert t2.budgeted_amount == Decimal('-123.45')
Expand All @@ -890,7 +890,7 @@ def test_3_verify_db(self, testdb):
assert t2.budget_transactions[0].budget_id == 2
assert t2.budget_transactions[0].amount == Decimal('-123.45')
rec2 = testdb.query(TxnReconcile).get(3)
assert rec2.txn_id == 5
assert rec2.txn_id == 6
assert rec2.ofx_fitid is None
assert rec2.ofx_account_id is None
assert rec2.note == desc
16 changes: 8 additions & 8 deletions biweeklybudget/tests/acceptance/flaskapp/views/test_fuel.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ def test_10_fuel_verify_db(self, testdb):
trans_ids = [
x.id for x in testdb.query(Transaction).all()
]
assert len(trans_ids) == 3
assert max(trans_ids) == 3
assert len(trans_ids) == 4
assert max(trans_ids) == 4

def test_11_fuel_populate_modal(self, base_url, selenium):
self.get(selenium, base_url + '/fuel')
Expand Down Expand Up @@ -584,8 +584,8 @@ def test_13_fuel_verify_db(self, testdb):
trans_ids = [
x.id for x in testdb.query(Transaction).all()
]
assert len(trans_ids) == 3
assert max(trans_ids) == 3
assert len(trans_ids) == 4
assert max(trans_ids) == 4

def test_14_fuel_add_with_trans(self, base_url, selenium):
self.get(selenium, base_url + '/fuel')
Expand Down Expand Up @@ -648,7 +648,7 @@ def test_14_fuel_add_with_trans(self, base_url, selenium):
x = body.find_elements_by_tag_name('div')[0]
assert 'alert-success' in x.get_attribute('class')
assert x.text.strip() == 'Successfully saved FuelFill 8 ' \
'and Transaction 4 in database.'
'and Transaction 5 in database.'
# dismiss the modal
selenium.find_element_by_id('modalCloseButton').click()
self.wait_for_jquery_done(selenium)
Expand Down Expand Up @@ -686,9 +686,9 @@ def test_15_fuel_verify_db(self, testdb):
trans_ids = [
x.id for x in testdb.query(Transaction).all()
]
assert len(trans_ids) == 4
assert max(trans_ids) == 4
trans = testdb.query(Transaction).get(4)
assert len(trans_ids) == 5
assert max(trans_ids) == 5
trans = testdb.query(Transaction).get(5)
assert trans.date == (dtnow() - timedelta(days=2)).date()
assert trans.actual_amount == Decimal('14.82')
assert trans.budgeted_amount is None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_credit_table(self, selenium):
'Account', 'Balance', 'Available', 'Avail - Unrec'
]
assert self.tbody2textlist(table) == [
['CreditOne', '-$952.06 (13 hours ago)', '$1,047.94', '$825.72'],
['CreditOne', '-$952.06 (13 hours ago)', '$1,047.94', '$503.40'],
['CreditTwo', '-$5,498.65 (a day ago)', '$1.35', '$1.35']
]
links = []
Expand Down
Loading

0 comments on commit 09e6d5c

Please sign in to comment.