Skip to content

Commit

Permalink
fix(handler): use correct 'yesterday' date string for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-ley committed Aug 30, 2021
1 parent 7b5853e commit 2bc25c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ def report_cost(event, context, result: dict = None, yesterday: str = None, new_
example_result2 = json.load(f)

# New Method with 2 example jsons
cost_dict = report_cost(None, None, example_result, yesterday="2021-08-22", new_method=True)
cost_dict = report_cost(None, None, example_result, yesterday="2021-08-23", new_method=True)
assert "{0:.2f}".format(cost_dict.get("total", 0.0)) == "286.37", f'{cost_dict.get("total"):,.2f} != 286.37'
cost_dict = report_cost(None, None, example_result2, yesterday="2021-08-28", new_method=True)
cost_dict = report_cost(None, None, example_result2, yesterday="2021-08-29", new_method=True)
assert "{0:.2f}".format(cost_dict.get("total", 0.0)) == "21.45", f'{cost_dict.get("total"):,.2f} != 21.45'

# Old Method with same jsons (will fail)
cost_dict = report_cost(None, None, example_result, yesterday="2021-08-22", new_method=False)
cost_dict = report_cost(None, None, example_result, yesterday="2021-08-23", new_method=False)
assert "{0:.2f}".format(cost_dict.get("total", 0.0)) == "286.37", f'{cost_dict.get("total"):,.2f} != 286.37'
cost_dict = report_cost(None, None, example_result2, yesterday="2021-08-28", new_method=False)
cost_dict = report_cost(None, None, example_result2, yesterday="2021-08-29", new_method=False)
assert "{0:.2f}".format(cost_dict.get("total", 0.0)) == "21.45", f'{cost_dict.get("total"):,.2f} != 21.45'

0 comments on commit 2bc25c9

Please sign in to comment.