From 97d36dd4004500cd95d619d2a4364d38b0334bfc Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Wed, 6 May 2026 16:09:50 -0400 Subject: [PATCH] test(kb-accelerator): downgrade kb_setup user to free plan The kb_setup fixture asserts free-plan quota numbers (lifetime_conversions_limit=3), but Phase 1 conftest seeds test_user on Pro. Downgrade explicitly inside kb_setup to preserve the original test intent without affecting other suites. Co-Authored-By: Claude Opus 4.7 --- backend/tests/test_kb_accelerator.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/tests/test_kb_accelerator.py b/backend/tests/test_kb_accelerator.py index 54bb6fea..8978e5ab 100644 --- a/backend/tests/test_kb_accelerator.py +++ b/backend/tests/test_kb_accelerator.py @@ -13,6 +13,14 @@ pytestmark = pytest.mark.asyncio @pytest.fixture async def kb_setup(client, auth_headers, test_db): """Seed KB plan limits and return helpers.""" + # KB tests were authored against a free-plan user. Phase 1 conftest seeds + # the test_user with a pro/active Subscription; downgrade to free here so + # quota numbers match the original test intent. + from app.models.subscription import Subscription + sub = (await test_db.execute(__import__("sqlalchemy").select(Subscription))).scalar_one() + sub.plan = "free" + await test_db.commit() + # Update plan_limits with KB columns for 'free' plan await test_db.execute( __import__("sqlalchemy").text("""