Created At: 2026-11-18T08:59:21Z Completed At: 2026-11-18T08:59: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 1 item tests/integration/test_plugins_api.py::test_plugins_module_full_lifecycle FAILED [100%] =================================== FAILURES =================================== ______________________ test_plugins_module_full_lifecycle ______________________ async_client = db_session = @pytest.mark.asyncio async def test_plugins_module_full_lifecycle( async_client: AsyncClient, db_session: AsyncSession, ): # 1. Register User and Create Tenant email = f"plugin_user_{uuid.uuid4().hex[:6]}@example.com" reg_resp = await async_client.post( "/api/v1/auth/register", json={"email": email, "password": "Password123!", "full_name": "Plugin Architect"}, ) assert reg_resp.status_code == 201 token = reg_resp.json()["data"]["access_token"] headers = { "Authorization": f"Bearer {token}", } tenant_resp = await async_client.post( "/api/v1/tenants", headers=headers, json={"name": "Plugins Extensibility Inc", "slug": f"plugins-{uuid.uuid4().hex[:6]}"}, ) assert tenant_resp.status_code == 201 tenant_id = tenant_resp.json()["data"]["id"] headers["X-Tenant-ID"] = tenant_id # 2. List Available Plugins Catalog cat_resp = await async_client.get("/api/v1/plugins") assert cat_resp.status_code == 200 catalog = cat_resp.json()["data"] assert len(catalog) >= 4 plugin_ids = [p["id"] for p in catalog] assert "welcome_captcha" in plugin_ids assert "crypto_price_tracker" in plugin_ids assert "sentiment_analyzer" in plugin_ids assert "auto_support_router" in plugin_ids crypto_plugin = next(p for p in catalog if p["id"] == "crypto_price_tracker") assert crypto_plugin["is_official"] is True assert "messages:write" in crypto_plugin["required_permissions"] # 3. List Installed Plugins initially (should be empty) inst_resp = await async_client.get("/api/v1/plugins/installed", headers=headers) assert inst_resp.status_code == 200 assert len(inst_resp.json()["data"]) == 0 # 4. Activate Plugin for Tenant act_resp = await async_client.post( "/api/v1/plugins/activate", headers=headers, json={ "plugin_id": "crypto_price_tracker", "config": { "default_currency": "USD", "custom_symbols": ["BTC", "ETH", "TON"], }, }, ) assert act_resp.status_code == 201 act_data = act_resp.json()["data"] tenant_plugin_id = act_data["id"] assert act_data["plugin_id"] == "crypto_price_tracker" assert act_data["is_enabled"] is True assert act_data["config"]["default_currency"] == "USD" assert "messages:write" in act_data["granted_permissions"] # 5. Duplicate Activation returns 409 Conflict dup_resp = await async_client.post( "/api/v1/plugins/activate", headers=headers, json={"plugin_id": "crypto_price_tracker"}, ) assert dup_resp.status_code == 409 # 6. Verify Installed Plugins List inst_resp2 = await async_client.get("/api/v1/plugins/installed", headers=headers) assert inst_resp2.status_code == 200 assert len(inst_resp2.json()["data"]) == 1 assert inst_resp2.json()["data"][0]["id"] == tenant_plugin_id # 7. Execute Sandboxed Plugin Hook (on_command) exec_resp = await async_client.post( f"/api/v1/plugins/{tenant_plugin_id}/execute", headers=headers, json={ "hook_name": "on_command", "payload": { "command": "price", "args": ["BTC"], }, }, ) assert exec_resp.status_code == 200 exec_data = exec_resp.json()["data"] assert exec_data["success"] is True assert exec_data["hook_name"] == "on_command" assert "symbol" in exec_data["output"] assert exec_data["output"]["symbol"] == "BTC" > assert "price" in exec_data["output"] E AssertionError: assert 'price' in {'symbol': 'BTC', 'price_usd': 96450.0, 'formatted': '$96,450.00', '24h_change': '+3.45%'} tests/integration/test_plugins_api.py:105: AssertionError ----------------------------- Captured stdout call ----------------------------- 2026-11-18 08:59:27 [info ] dispatching_domain_event event_id=e7f8d58b-7802-4846-aa69-4699712ab3b1 event_type=UserRegisteredEvent handlers_count=0 2026-11-18 08:59:27 [info ] dispatching_domain_event event_id=1bc65a66-92a5-4de4-ad63-9caa6e2e2d00 event_type=TenantCreatedEvent handlers_count=0 2026-11-18 08:59:27 [warning ] app_exception_handled error_code=CONFLICT message="Plugin 'Crypto Price & Alert Tracker' is already installed for this tenant/bot" method=POST path=/api/v1/plugins/activate =========================== short test summary info ============================ FAILED tests/integration/test_plugins_api.py::test_plugins_module_full_lifecycle ============================== 1 failed in 0.82s ===============================