Add tests (& placeholder tests) for new reporting
This commit is contained in:
parent
ac4b15e4b2
commit
29644a495b
0
tests/domain/cloud/reports/__init__.py
Normal file
0
tests/domain/cloud/reports/__init__.py
Normal file
50
tests/domain/cloud/reports/test_reports.py
Normal file
50
tests/domain/cloud/reports/test_reports.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
from atst.domain.csp.reports import MockReportingProvider
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_environment_monthly_totals():
|
||||||
|
environment = {
|
||||||
|
"name": "Test Environment",
|
||||||
|
"spending": {
|
||||||
|
"this_month": {"JEDI_CLIN_1": 100, "JEDI_CLIN_2": 100},
|
||||||
|
"last_month": {"JEDI_CLIN_1": 200, "JEDI_CLIN_2": 200},
|
||||||
|
"total": {"JEDI_CLIN_1": 1000, "JEDI_CLIN_2": 1000},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
totals = MockReportingProvider._get_environment_monthly_totals(environment)
|
||||||
|
assert totals == {
|
||||||
|
"name": "Test Environment",
|
||||||
|
"this_month": 200,
|
||||||
|
"last_month": 400,
|
||||||
|
"total": 2000,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_application_monthly_totals():
|
||||||
|
application = {
|
||||||
|
"name": "Test Application",
|
||||||
|
"environments": [
|
||||||
|
{
|
||||||
|
"name": "Z",
|
||||||
|
"spending": {
|
||||||
|
"this_month": {"JEDI_CLIN_1": 50, "JEDI_CLIN_2": 50},
|
||||||
|
"last_month": {"JEDI_CLIN_1": 150, "JEDI_CLIN_2": 150},
|
||||||
|
"total": {"JEDI_CLIN_1": 250, "JEDI_CLIN_2": 250},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "A",
|
||||||
|
"spending": {
|
||||||
|
"this_month": {"JEDI_CLIN_1": 100, "JEDI_CLIN_2": 100},
|
||||||
|
"last_month": {"JEDI_CLIN_1": 200, "JEDI_CLIN_2": 200},
|
||||||
|
"total": {"JEDI_CLIN_1": 1000, "JEDI_CLIN_2": 1000},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
totals = MockReportingProvider._get_application_monthly_totals(application)
|
||||||
|
assert totals["name"] == "Test Application"
|
||||||
|
assert totals["this_month"] == 300
|
||||||
|
assert totals["last_month"] == 700
|
||||||
|
assert totals["total"] == 2500
|
||||||
|
assert [env["name"] for env in totals["environments"]] == ["A", "Z"]
|
@ -1,22 +1,8 @@
|
|||||||
from atst.domain.reports import Reports
|
# TODO: Implement when we get real reporting data
|
||||||
from tests.factories import *
|
|
||||||
|
|
||||||
|
|
||||||
# this is sketched out until we do real reporting
|
|
||||||
def test_monthly_totals():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# this is sketched out until we do real reporting
|
|
||||||
def test_current_obligated_funds():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# this is sketched out until we do real reporting
|
|
||||||
def test_expired_task_orders():
|
def test_expired_task_orders():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# this is sketched out until we do real reporting
|
# TODO: Implement when we get real reporting data
|
||||||
def test_obligated_funds_by_JEDI_clin():
|
def test_obligated_funds_by_JEDI_clin():
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user