fin-hub/tests/test_coupling.py
tegwick 1abbbe85e4 Implement fin-hub T24-T26: ingest, runway, coupling, RaaS packaging
Add CSV importers, runway calculator, budget alerts, cross-hub coupling
emitters, finhub CLI, and raas-mvp-packaging docs with full test coverage.
2026-07-08 00:59:39 +02:00

24 lines
No EOL
837 B
Python

import pytest
from fin_hub.coupling.ops_hub import ServiceCostLine, build_service_cost_report
from fin_hub.ingest.hosteurope import parse_hosteurope_csv
from pathlib import Path
def test_build_service_cost_report_groups_by_service():
rows = parse_hosteurope_csv(Path(__file__).parent / "fixtures" / "hosteurope.csv")
lines = [
ServiceCostLine(
service_id=row.service_id,
environment=row.environment,
period_month=row.period_month,
amount=row.amount,
currency=row.currency,
source=row.source,
)
for row in rows
]
report = build_service_cost_report(lines)
assert report["signal"] == "service_cost_attribution"
assert len(report["services"]) == 2
assert report["totals_by_month"]["2026-06"] == pytest.approx(99.8)