From 84bfdc819c4a7e16ea25b7acb95bcbc1c49dd083 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 17 Jan 2019 14:31:48 -0500 Subject: [PATCH 1/3] Fix typo in environment name in mock reports --- atst/domain/csp/reports.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atst/domain/csp/reports.py b/atst/domain/csp/reports.py index cd87d46c..a16fbdcc 100644 --- a/atst/domain/csp/reports.py +++ b/atst/domain/csp/reports.py @@ -183,7 +183,7 @@ class MockReportingProvider(ReportingInterface): "Beluga": { "cumulative": CUMULATIVE_BUDGET_BELUGA, "applications": [ - MockApplication("NP02", ["Integ", "PreProd", "NP02_Prod"]), + MockApplication("NP02", ["Integ", "PreProd", "Prod"]), MockApplication("FM", ["Integ", "Prod"]), ], "budget": 70000, From 3cd2644a886e4194de713ca2e826fbf813caefe1 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 17 Jan 2019 14:44:23 -0500 Subject: [PATCH 2/3] Use date range for mock data instead of current year only --- atst/domain/csp/reports.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/atst/domain/csp/reports.py b/atst/domain/csp/reports.py index a16fbdcc..3611a45c 100644 --- a/atst/domain/csp/reports.py +++ b/atst/domain/csp/reports.py @@ -296,10 +296,13 @@ class MockReportingProvider(ReportingInterface): else: budget_months = {} - this_year = pendulum.now().year + end = pendulum.now() + start = end.subtract(months=12) + period = pendulum.period(start, end) + all_months = OrderedDict() - for m in range(1, 13): - month_str = "{month:02d}/{year}".format(month=m, year=this_year) + for t in period.range("months"): + month_str = "{month:02d}/{year}".format(month=t.month, year=t.year) all_months[month_str] = budget_months.get(month_str, None) return {"months": all_months} From eb58d6a156353018585feb6d58017ea2b1d67417 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 17 Jan 2019 14:56:58 -0500 Subject: [PATCH 3/3] Fix mock report tests --- tests/domain/test_reports.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/domain/test_reports.py b/tests/domain/test_reports.py index 388622dc..2307abcb 100644 --- a/tests/domain/test_reports.py +++ b/tests/domain/test_reports.py @@ -35,4 +35,4 @@ def test_cumulative_budget(): portfolio = PortfolioFactory.create(request=request) months = Reports.cumulative_budget(portfolio) - assert len(months["months"]) == 12 + assert len(months["months"]) >= 12