Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SamDudley committed Mar 22, 2024
1 parent aa2987d commit 90be419
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
23 changes: 9 additions & 14 deletions end_of_month/test/test_end_of_month_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,15 @@ def check_archive_period(self, tested_period):
end_of_month_archive(tested_period)
# run a query giving the full total
archived_total = self.get_period_total(tested_period)
self.assertEqual(total_before, archived_total)
assert total_before == archived_total
change_amount = tested_period * 10000
self.init_data.monthly_figure_update(tested_period + 1, change_amount)
current_total = self.get_current_total()
self.archived_figure[tested_period] = archived_total
self.assertNotEqual(current_total, archived_total)
self.assertEqual(current_total, (archived_total + change_amount))
assert current_total != archived_total
assert current_total == (archived_total + change_amount)
for period in range(1, tested_period + 1):
self.assertEqual(
self.archived_figure[period], self.get_period_total(period)
)
assert self.archived_figure[period] == self.get_period_total(period)

# The following tests check that the archived figures are not changed by
# changing the current figures.
Expand Down Expand Up @@ -351,23 +349,20 @@ def check_archive_period(self, tested_period):
end_of_month_archive(tested_period)
# run a query giving the full total
archived_total = self.get_period_budget_total(tested_period)
self.assertEqual(total_before, archived_total)
assert total_before == archived_total
change_amount = tested_period * 10000
self.init_data.monthly_figure_update(tested_period + 1, change_amount, "budget")
current_total = self.get_current_budget_total()
self.archived_figure[tested_period] = archived_total
self.assertNotEqual(current_total, archived_total)
self.assertNotEqual(current_total, archived_total)
self.assertEqual(current_total, (archived_total + change_amount))
assert current_total != archived_total
assert current_total == (archived_total + change_amount)

for period in range(1, tested_period + 1):
# Check the full total. It is saved in a different table, for convenience
monthly_budget = MonthlyTotalBudget.objects.get(archived_period=period)
self.assertEqual(self.archived_figure[period], monthly_budget.amount)
assert self.archived_figure[period], monthly_budget.amount)
# Check that nothig has corrupted the archived figures
self.assertEqual(
self.archived_figure[period], self.get_period_budget_total(period)
)
assert self.archived_figure[period] == self.get_period_budget_total(period)

# The following tests check that the archived figures are not changed by
# changing the current figures.
Expand Down
8 changes: 4 additions & 4 deletions end_of_month/test/test_outturn_variance.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ def check_archive_period(self, tested_period):
end_of_month_archive(tested_period, True)
# run a query giving the full total
archived_total = self.get_period_total(tested_period)
self.assertEqual(total_before, archived_total)
assert total_before == archived_total

previous_outurn = self.get_current_previous_outturn()
self.assertEqual(total_before, previous_outurn)
assert total_before == previous_outurn

change_amount = tested_period * 10000
self.init_data.monthly_figure_update(tested_period + 1, change_amount)
current_total = self.get_current_total()
self.archived_figure[tested_period] = archived_total
self.assertNotEqual(current_total, previous_outurn)
self.assertEqual(current_total, (previous_outurn + change_amount))
assert current_total != previous_outurn
assert current_total == (previous_outurn + change_amount)

# The following tests check that the previous outturn figure is not changed by
# changing the current figures.
Expand Down

0 comments on commit 90be419

Please sign in to comment.