Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: add guard tests for billing (#33831)
hj24886854eff86b
diff --git a/api/services/billing_service.py b/api/services/billing_service.pyindex 5ab47c799ad..70d4ce1ee6b 100644--- a/api/services/billing_service.py+++ b/api/services/billing_service.py@@ -335,7 +335,11 @@ class BillingService:# Redis returns bytes, decode to string and parse JSONjson_str = cached_value.decode("utf-8") if isinstance(cached_value, bytes) else cached_valueplan_dict = json.loads(json_str)+ # NOTE (hj24): New billing versions may return timestamp as str, and validate_python+ # in non-strict mode will coerce it to the expected int type.+ # To preserve compatibility, always keep non-strict mode here and avoid strict mode.subscription_plan = subscription_adapter.validate_python(plan_dict)+ # NOTE ENDtenant_plans[tenant_id] = subscription_planexcept Exception:logger.exception(diff --git a/api/tests/unit_tests/services/test_billing_service.py b/api/tests/unit_tests/services/test_billing_service.pyindex eecb3c7672d..316381f0ca1 100644--- a/api/tests/unit_tests/services/test_billing_service.py+++ b/api/tests/unit_tests/services/test_billing_service.py@@ -1303,6 +1303,24 @@ class TestBillingServiceSubscriptionOperations:# Assertassert result == {}+ def test_get_plan_bulk_converts_string_expiration_date_to_int(self, mock_send_request):+ """Test bulk plan retrieval converts string expiration_date to int."""+ # Arrange+ tenant_ids = ["tenant-1"]+ mock_send_request.return_value = {+ "data": {+ "tenant-1": {"plan": "sandbox", "expiration_date": "1735689600"},+ }+ }++ # Act+ result = BillingService.get_plan_bulk(tenant_ids)++ # Assert+ assert "tenant-1" in result+ assert isinstance(result["tenant-1"]["expiration_date"], int)+ assert result["tenant-1"]["expiration_date"] == 1735689600+def test_get_plan_bulk_with_invalid_tenant_plan_skipped(self, mock_send_request):"""Test bulk plan retrieval when one tenant has invalid plan data (should skip that tenant)."""# Arrange