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 testpaths: tests 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 72 items tests/integration/test_auth.py::test_auth_workflow PASSED [ 1%] tests/integration/test_billing_checkout_and_lifecycle.py::test_full_billing_lifecycle_and_security PASSED [ 2%] tests/integration/test_billing_webhooks.py::test_razorpay_and_stripe_webhooks_and_deduplication PASSED [ 4%] tests/integration/test_celery_telegram_tasks.py::test_telegram_update_task_execution PASSED [ 5%] tests/integration/test_emojis_api.py::test_search_emojis_by_term PASSED [ 6%] tests/integration/test_emojis_api.py::test_search_emojis_by_category PASSED [ 8%] tests/integration/test_emojis_api.py::test_get_categories_list PASSED [ 9%] tests/integration/test_emojis_api.py::test_bulk_emoji_import_and_packs_management PASSED [ 11%] tests/integration/test_health.py::test_health_liveness PASSED [ 12%] tests/integration/test_health.py::test_health_readiness PASSED [ 13%] tests/integration/test_i18n_api.py::test_get_locales_list PASSED [ 15%] tests/integration/test_i18n_api.py::test_get_translation_bundle PASSED [ 16%] tests/integration/test_i18n_api.py::test_update_user_locale PASSED [ 18%] tests/integration/test_i18n_api.py::test_save_custom_translation_override PASSED [ 19%] tests/integration/test_i18n_api.py::test_audit_translations_and_missing_keys PASSED [ 20%] tests/integration/test_i18n_api.py::test_ai_translation_and_human_approval_workflow PASSED [ 22%] tests/integration/test_message_studio_api.py::test_bot_message_studio_lifecycle PASSED [ 23%] tests/integration/test_message_studio_e2e_publishing.py::test_message_studio_publishing_changes_real_bot_response PASSED [ 25%] tests/integration/test_multi_bot_engine.py::test_multi_tenant_multi_bot_engine_lifecycle FAILED [ 26%] tests/integration/test_multilingual_bot_responses.py::test_language_selection_in_actual_bot_responses PASSED [ 27%] tests/integration/test_text_designer_api.py::test_text_designer_api_endpoints PASSED [ 29%] tests/tenant_isolation/test_tenant_isolation.py::test_strict_tenant_isolation PASSED [ 30%] tests/unit/test_billing_gateways.py::test_razorpay_payment_signature_verification PASSED [ 31%] tests/unit/test_billing_gateways.py::test_razorpay_webhook_signature_verification PASSED [ 33%] tests/unit/test_billing_gateways.py::test_stripe_webhook_signature_verification PASSED [ 34%] tests/unit/test_billing_gateways.py::test_gateway_factory_resolution PASSED [ 36%] tests/unit/test_bot_engine.py::test_bot_token_validation_with_getme PASSED [ 37%] tests/unit/test_bot_engine.py::test_bot_token_encryption_and_decryption PASSED [ 38%] tests/unit/test_bot_engine.py::test_webhook_secret_generation_and_verification PASSED [ 40%] tests/unit/test_bot_engine.py::test_rate_limit_retry_handling PASSED [ 41%] tests/unit/test_coupons_and_entitlements.py::test_coupon_validation_and_discounts PASSED [ 43%] tests/unit/test_coupons_and_entitlements.py::test_entitlement_enforcement_and_feature_gates PASSED [ 44%] tests/unit/test_emojis.py::test_telegram_html_emoji_formatting PASSED [ 45%] tests/unit/test_emojis.py::test_telegram_markdown_emoji_formatting PASSED [ 47%] tests/unit/test_emojis.py::test_id_precision_is_preserved_as_string PASSED [ 48%] tests/unit/test_emojis.py::test_custom_emoji_validation PASSED [ 50%] tests/unit/test_formatter_and_engine.py::test_box_header_formatting PASSED [ 51%] tests/unit/test_formatter_and_engine.py::test_separator_presets PASSED [ 52%] tests/unit/test_formatter_and_engine.py::test_info_block_formatting PASSED [ 54%] tests/unit/test_formatter_and_engine.py::test_progress_bar_generation PASSED [ 55%] tests/unit/test_formatter_and_engine.py::test_progress_step_header PASSED [ 56%] tests/unit/test_formatter_and_engine.py::test_telegram_message_builder PASSED [ 58%] tests/unit/test_i18n.py::test_supported_locales_catalog PASSED [ 59%] tests/unit/test_i18n.py::test_rtl_detection PASSED [ 61%] tests/unit/test_i18n.py::test_plural_rules PASSED [ 62%] tests/unit/test_i18n.py::test_formatting PASSED [ 63%] tests/unit/test_i18n.py::test_fallback_resolution PASSED [ 65%] tests/unit/test_i18n.py::test_translation_engine PASSED [ 66%] tests/unit/test_i18n.py::test_bcp47_locale_normalization PASSED [ 68%] tests/unit/test_i18n.py::test_interpolation PASSED [ 69%] tests/unit/test_i18n.py::test_missing_translation_fallback PASSED [ 70%] tests/unit/test_i18n.py::test_telegram_keyboard_builder PASSED [ 72%] tests/unit/test_message_studio.py::test_variable_interpolation PASSED [ 73%] tests/unit/test_message_studio.py::test_missing_variables_fallback PASSED [ 75%] tests/unit/test_message_studio.py::test_keyboard_matrix_ordering PASSED [ 76%] tests/unit/test_message_studio.py::test_aiogram_keyboard_generation PASSED [ 77%] tests/unit/test_message_studio.py::test_default_system_templates PASSED [ 79%] tests/unit/test_security.py::test_password_hashing PASSED [ 80%] tests/unit/test_security.py::test_aes_256_gcm_encryption PASSED [ 81%] tests/unit/test_security.py::test_jwt_tokens PASSED [ 83%] tests/unit/test_security.py::test_token_hashing PASSED [ 84%] tests/unit/test_unicode_styler.py::test_small_caps_transformation PASSED [ 86%] tests/unit/test_unicode_styler.py::test_tag_and_variable_preservation PASSED [ 87%] tests/unit/test_unicode_styler.py::test_other_unicode_styles PASSED [ 88%] tests/unit/test_unicode_styler.py::test_symbol_catalog_contents PASSED [ 90%] tests/unit/test_validators_and_presets.py::test_html_validator_valid PASSED [ 91%] tests/unit/test_validators_and_presets.py::test_html_validator_invalid_tags PASSED [ 93%] tests/unit/test_validators_and_presets.py::test_html_validator_unclosed_tags PASSED [ 94%] tests/unit/test_validators_and_presets.py::test_message_length_validator PASSED [ 95%] tests/unit/test_validators_and_presets.py::test_callback_data_validator PASSED [ 97%] tests/unit/test_validators_and_presets.py::test_preset_manager_loads_all_presets PASSED [ 98%] tests/unit/test_wallet_and_ledger.py::test_wallet_credit_debit_and_immutable_checksum PASSED [100%] =================================== FAILURES =================================== _________________ test_multi_tenant_multi_bot_engine_lifecycle _________________ async_client = db_session = @pytest.mark.asyncio async def test_multi_tenant_multi_bot_engine_lifecycle( async_client: AsyncClient, db_session: AsyncSession, ): # ------------------------------------------------------------- # 1. Setup Mock Bot Tokens # ------------------------------------------------------------- token_a1 = f"token_a1_{uuid.uuid4().hex[:8]}_test" token_a2 = f"token_a2_{uuid.uuid4().hex[:8]}_test" token_b1 = f"token_b1_{uuid.uuid4().hex[:8]}_test" bot_uname_a1 = f"alpha_bot_1_{uuid.uuid4().hex[:6]}" bot_uname_a2 = f"alpha_bot_2_{uuid.uuid4().hex[:6]}" bot_uname_b1 = f"beta_bot_1_{uuid.uuid4().hex[:6]}" TelegramApiService.register_mock_bot(token_a1, bot_uname_a1, "Alpha One") TelegramApiService.register_mock_bot(token_a2, bot_uname_a2, "Alpha Two") TelegramApiService.register_mock_bot(token_b1, bot_uname_b1, "Beta One") # ------------------------------------------------------------- # 2. Register User A & Tenant Alpha # ------------------------------------------------------------- user_a_email = f"user_a_{uuid.uuid4().hex[:6]}@example.com" resp_a = await async_client.post( "/api/v1/auth/register", json={"email": user_a_email, "password": "PasswordA123!", "full_name": "Alice Alpha"}, ) token_user_a = resp_a.json()["data"]["access_token"] tenant_a_resp = await async_client.post( "/api/v1/tenants", headers={"Authorization": f"Bearer {token_user_a}"}, json={"name": "Tenant Alpha Org", "slug": f"alpha-{uuid.uuid4().hex[:6]}"}, ) tenant_a_id = tenant_a_resp.json()["data"]["id"] headers_a = { "Authorization": f"Bearer {token_user_a}", "X-Tenant-ID": str(tenant_a_id), } # ------------------------------------------------------------- # 3. Register User B & Tenant Beta # ------------------------------------------------------------- user_b_email = f"user_b_{uuid.uuid4().hex[:6]}@example.com" resp_b = await async_client.post( "/api/v1/auth/register", json={"email": user_b_email, "password": "PasswordB123!", "full_name": "Bob Beta"}, ) token_user_b = resp_b.json()["data"]["access_token"] tenant_b_resp = await async_client.post( "/api/v1/tenants", headers={"Authorization": f"Bearer {token_user_b}"}, json={"name": "Tenant Beta Org", "slug": f"beta-{uuid.uuid4().hex[:6]}"}, ) tenant_b_id = tenant_b_resp.json()["data"]["id"] headers_b = { "Authorization": f"Bearer {token_user_b}", "X-Tenant-ID": str(tenant_b_id), } # ------------------------------------------------------------- # 4. Tenant Alpha Registers Bot A1 and Bot A2 # ------------------------------------------------------------- reg_a1 = await async_client.post( "/api/v1/bots", headers=headers_a, json={"token": token_a1, "name": "Alpha Bot 1", "default_locale": "en"}, ) assert reg_a1.status_code == 201, reg_a1.text bot_a1_data = reg_a1.json()["data"] bot_a1_id = bot_a1_data["id"] assert bot_a1_data["username"] == bot_uname_a1 assert bot_a1_data["webhook_active"] is True # Ensure raw token was NEVER returned assert "token" not in bot_a1_data assert "encrypted_token" not in bot_a1_data reg_a2 = await async_client.post( "/api/v1/bots", headers=headers_a, json={"token": token_a2, "name": "Alpha Bot 2", "default_locale": "hi"}, ) > assert reg_a2.status_code == 201 E assert 429 == 201 E + where 429 = .status_code tests/integration/test_multi_bot_engine.py:96: AssertionError ----------------------------- Captured stdout call ----------------------------- 2026-11-18 08:44:24 [info ] dispatching_domain_event event_id=a3308955-9a60-4a7b-a6be-d19abce7339d event_type=UserRegisteredEvent handlers_count=0 2026-11-18 08:44:24 [info ] dispatching_domain_event event_id=a18bb453-bc67-45bf-9688-f2043e37c89f event_type=TenantCreatedEvent handlers_count=0 2026-11-18 08:44:24 [info ] dispatching_domain_event event_id=dbd63690-7610-41b7-8477-9a3add83f41d event_type=UserRegisteredEvent handlers_count=0 2026-11-18 08:44:24 [info ] dispatching_domain_event event_id=04f5a0fc-d340-417e-86f2-5cd8858e2415 event_type=TenantCreatedEvent handlers_count=0 2026-11-18 08:44:24 [info ] bot_registered_successfully bot_id=43e64742-f16c-4ba3-9d7e-7456a832bae0 tenant_id=1f63e76c-135f-4a37-8a93-9f459436ba3f username=alpha_bot_1_8ce8f6 2026-11-18 08:44:24 [warning ] app_exception_handled error_code=QUOTA_EXCEEDED message="Plan 'Free Tier' limit of 1 active bot(s) reached. Please upgrade your subscription to connect more bots." method=POST path=/api/v1/bots =========================== short test summary info ============================ FAILED tests/integration/test_multi_bot_engine.py::test_multi_tenant_multi_bot_engine_lifecycle ========================= 1 failed, 71 passed in 6.53s =========================