fix: gate cClassTrib applicability by CRT and date

This commit is contained in:
gti
2026-09-25 17:47:04 -03:00
parent 95605c2ff5
commit 4a12640031
25 changed files with 498 additions and 72 deletions
@@ -606,3 +606,18 @@ def test_rtc_status_view_is_discreet_and_optional():
assert on["label"] == "Ativa" and on["enabled"] and on["catalog_valid"]
assert blocker_type_label("RTC_CST_MISSING") == "CST IBS/CBS ausente no catálogo" and blocker_type_label("COFINS_RATE_INVALID") == "Alíquota COFINS inválida"
assert blocker_type_label("PIS_CST_INCIDENCE_MISMATCH") == "CST PIS incompatível com a incidência"
def test_rtc_status_view_hides_product_pending_when_cclasstrib_is_not_applicable():
from central.app.panel_presentation import rtc_status_view
result = rtc_status_view({"fiscal_context": {
"rtc_enabled": True,
"rtc_resolution": {"total": 521, "valid_existing": 0, "ready_to_apply": 0, "insufficient": 521},
"cclasstrib_applicability": {"state": "NOT_APPLICABLE", "basis": "SIMPLES_CCLASSTRIB_NOT_EFFECTIVE"},
}})
assert result["enabled"] is True
assert result["products"]["applicable"] is False
assert result["products"]["label"] == "cClassTrib: Não utilizado neste cliente"
assert "pendente" not in result["products"].get("headline", "").lower()