test(billing): add comprehensive service layer tests and fix deactivate_tier bug
Add 139 tests across 3 test files for the billing service layer: - test_subscription_service.py (37 tests): tier lookup, subscription CRUD, upgrades, cancellation - test_admin_subscription_service.py (39 tests): admin tier/subscription management, stats, billing history - test_billing_service.py (43 tests): rewritten with correct fixtures after store→merchant migration Fix production bug in deactivate_tier() — BusinessLogicException was missing required error_code argument, now uses TIER_HAS_ACTIVE_SUBSCRIPTIONS. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -119,7 +119,8 @@ class AdminSubscriptionService:
|
||||
|
||||
if active_subs > 0:
|
||||
raise BusinessLogicException(
|
||||
f"Cannot delete tier: {active_subs} active subscriptions are using it"
|
||||
f"Cannot delete tier: {active_subs} active subscriptions are using it",
|
||||
"TIER_HAS_ACTIVE_SUBSCRIPTIONS",
|
||||
)
|
||||
|
||||
tier.is_active = False
|
||||
|
||||
Reference in New Issue
Block a user