feat: organize bot menu into Copy, AI, Bots, System, Monitor categories
This commit is contained in:
@@ -5,16 +5,18 @@ from core.llm import LLMClient
|
||||
from services.admin_bot import get_persian_main_menu, AdminBotService
|
||||
|
||||
|
||||
def test_main_menu_pause_toggle():
|
||||
menu_running = get_persian_main_menu(is_paused=False)
|
||||
button_texts_running = [getattr(b.button, 'text', '') for row in menu_running for b in row]
|
||||
assert any("🛑 توقف" in t for t in button_texts_running)
|
||||
assert not any("▶️ راهاندازی" in t for t in button_texts_running)
|
||||
async def test_system_hub_pause_toggle():
|
||||
repo = AsyncMock()
|
||||
repo.is_system_paused.return_value = False
|
||||
admin_bot = AdminBotService(repo=repo, ai_processor=None, queue=None, review_channel_id=-100)
|
||||
text, buttons = await admin_bot._render_system_hub()
|
||||
btn_texts = [getattr(b, 'text', '') for row in buttons for b in row]
|
||||
assert any("🛑 توقف" in t for t in btn_texts)
|
||||
|
||||
menu_paused = get_persian_main_menu(is_paused=True)
|
||||
button_texts_paused = [getattr(b.button, 'text', '') for row in menu_paused for b in row]
|
||||
assert any("▶️ راهاندازی" in t for t in button_texts_paused)
|
||||
assert not any("🛑 توقف" in t for t in button_texts_paused)
|
||||
repo.is_system_paused.return_value = True
|
||||
text, buttons = await admin_bot._render_system_hub()
|
||||
btn_texts = [getattr(b, 'text', '') for row in buttons for b in row]
|
||||
assert any("▶️ راهاندازی" in t for t in btn_texts)
|
||||
|
||||
|
||||
async def test_llm_fallback_chain_success_on_fallback():
|
||||
@@ -137,7 +139,7 @@ async def test_llm_fallback_chain_all_fail_alert():
|
||||
|
||||
|
||||
async def main():
|
||||
test_main_menu_pause_toggle()
|
||||
await test_system_hub_pause_toggle()
|
||||
await test_llm_fallback_chain_success_on_fallback()
|
||||
await test_llm_fallback_chain_all_fail_alert()
|
||||
print("All system stop and multi-provider AI fallback chain tests passed successfully!")
|
||||
|
||||
Reference in New Issue
Block a user