Better incorporate fixture data into reporting
Before this commit, if a portfolio wasn't present in the spending fixture data, the reporting screen would be empty -- even if the portfolio had applications and environments associated with it on the database. Now, 0s appear if an application and / or environment isn't present in the fixture data.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from atst.domain.csp.reports import MockReportingProvider
|
||||
from tests.factories import PortfolioFactory
|
||||
|
||||
|
||||
def test_get_environment_monthly_totals():
|
||||
@@ -20,6 +21,11 @@ def test_get_environment_monthly_totals():
|
||||
|
||||
|
||||
def test_get_application_monthly_totals():
|
||||
portfolio = PortfolioFactory.create(
|
||||
applications=[
|
||||
{"name": "Test Application", "environments": [{"name": "Z"}, {"name": "A"}]}
|
||||
],
|
||||
)
|
||||
application = {
|
||||
"name": "Test Application",
|
||||
"environments": [
|
||||
@@ -42,7 +48,9 @@ def test_get_application_monthly_totals():
|
||||
],
|
||||
}
|
||||
|
||||
totals = MockReportingProvider._get_application_monthly_totals(application)
|
||||
totals = MockReportingProvider._get_application_monthly_totals(
|
||||
portfolio, application
|
||||
)
|
||||
assert totals["name"] == "Test Application"
|
||||
assert totals["this_month"] == 300
|
||||
assert totals["last_month"] == 700
|
||||
|
Reference in New Issue
Block a user