Created At: 2026-11-19T05:08:22Z Completed At: 2026-11-19T05:08:29Z Command exited with code 1. Command output: ============================= test session starts ============================== platform linux -- Python 3.12.3, pytest-9.2.0, pluggy-1.7.0 -- /root/telegram-saas/.venv/bin/python3 cachedir: .pytest_cache rootdir: /root/telegram-saas configfile: pyproject.toml plugins: anyio-4.16.0, asyncio-1.5.0 asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function collecting ... collected 7 items tests/unit/test_bot_modular_engine.py::test_module_catalog_definitions PASSED [ 14%] tests/unit/test_bot_modular_engine.py::test_bot_module_lifecycle PASSED [ 28%] tests/unit/test_bot_modular_engine.py::test_force_join_gating_behavior PASSED [ 42%] tests/unit/test_bot_modular_engine.py::test_referrals_and_growth_attribution PASSED [ 57%] tests/unit/test_bot_modular_engine.py::test_auto_filter_keyword_and_blocked_words PASSED [ 71%] tests/unit/test_bot_modular_engine.py::test_redeem_code_lifecycle_and_redemption FAILED [ 85%] tests/unit/test_bot_modular_engine.py::test_three_way_triggers_and_menu_generation PASSED [100%] =================================== FAILURES =================================== __________________ test_redeem_code_lifecycle_and_redemption ___________________ db_session = @pytest.mark.asyncio async def test_redeem_code_lifecycle_and_redemption(db_session: AsyncSession): """Verifies Redeem Code creation, anti-abuse checks, point/VIP rewards, and expiry.""" from datetime import datetime, timezone, timedelta bot = await create_dummy_bot(db_session, "Redeem Bot") bot_id = bot.id service = BotModuleService(db_session) # 1. Install redeem_codes module await service.install_module(bot_id, "redeem_codes") # 2. Create VIP code with max_uses=1 vip_code = await service.create_redeem_code( bot_id=bot_id, code="VIP-SUPER-30", reward_type="subscription_days", reward_value=30, max_uses=1, ) assert vip_code.code == "VIP-SUPER-30" assert vip_code.times_used == 0 # 3. Create Points code pts_code = await service.create_redeem_code( bot_id=bot_id, code="POINTS-100", reward_type="points", reward_value=100, max_uses=10, ) assert pts_code.code == "POINTS-100" # 4. User A redeems VIP code ok1, msg1, data1 = await service.redeem_code_for_user( bot_id=bot_id, telegram_user_id=1001, raw_code="VIP-SUPER-30", ) assert ok1 is True assert data1["reward_type"] == "subscription_days" assert data1["reward_value"] == 30 # 5. User A tries to redeem same VIP code again -> duplicate rejected ok_dup, msg_dup, _ = await service.redeem_code_for_user( bot_id=bot_id, telegram_user_id=1001, raw_code="VIP-SUPER-30", ) assert ok_dup is False > assert "already redeemed" in msg_dup.lower() E AssertionError: assert 'already redeemed' in '🚫 redeem code vip-super-30 has reached its maximum redemptions limit.' E + where '🚫 redeem code vip-super-30 has reached its maximum redemptions limit.' = () E + where = '🚫 Redeem code VIP-SUPER-30 has reached its maximum redemptions limit.'.lower tests/unit/test_bot_modular_engine.py:308: AssertionError =========================== short test summary info ============================ FAILED tests/unit/test_bot_modular_engine.py::test_redeem_code_lifecycle_and_redemption ========================= 1 failed, 6 passed in 0.69s ==========================