Add Reports domain method to get portfolio spend
This commit is contained in:
@@ -1,8 +1,31 @@
|
||||
# TODO: Implement when we get real reporting data
|
||||
def test_expired_task_orders():
|
||||
pass
|
||||
import pytest
|
||||
|
||||
from atst.domain.reports import Reports
|
||||
from tests.factories import PortfolioFactory
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
# TODO: Implement when we get real reporting data
|
||||
def test_obligated_funds_by_JEDI_clin():
|
||||
pass
|
||||
@pytest.fixture(scope="function")
|
||||
def portfolio():
|
||||
portfolio = PortfolioFactory.create()
|
||||
return portfolio
|
||||
|
||||
|
||||
class TestGetPortfolioSpending:
|
||||
csp_data = {
|
||||
"tenant_id": "",
|
||||
"billing_profile_properties": {
|
||||
"invoice_sections": [{"invoice_section_id": "",}]
|
||||
},
|
||||
}
|
||||
|
||||
def test_with_csp_data(self, portfolio):
|
||||
portfolio.csp_data = self.csp_data
|
||||
data = Reports.get_portfolio_spending(portfolio)
|
||||
assert data["invoiced"] == Decimal(1551.0)
|
||||
assert data["estimated"] == Decimal(500.0)
|
||||
|
||||
def test_without_csp_data(self, portfolio):
|
||||
data = Reports.get_portfolio_spending(portfolio)
|
||||
assert data["invoiced"] == Decimal(0)
|
||||
assert data["estimated"] == Decimal(0)
|
||||
|
Reference in New Issue
Block a user