From a9b698b4a08bff4a0747adca71a9b55808be4bff Mon Sep 17 00:00:00 2001 From: Yuki-Asuuna <10174503104@stu.ecnu.edu.cn> Date: Fri, 18 Feb 2022 14:34:43 +0800 Subject: =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=9C=8D=E5=8A=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=BE=93=E5=87=BA=20&=20=E5=8E=BB=E9=99=A4scheduler?= =?UTF-8?q?=20Warning=20&=20=E8=A1=A5=E5=85=85requirements.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I978daa50a7a60e9e551bd6a22d543ab24b6898da --- test/test_plugin_help.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'test/test_plugin_help.py') diff --git a/test/test_plugin_help.py b/test/test_plugin_help.py index ef30e1d..7bc0cf3 100644 --- a/test/test_plugin_help.py +++ b/test/test_plugin_help.py @@ -66,17 +66,22 @@ async def test_about_me(app: App): @pytest.mark.asyncio async def test_service_list(app: App): import os + import json + from tabulate import tabulate from ATRI.service import SERVICES_DIR from ATRI.plugins.help import service_list files = os.listdir(SERVICES_DIR) - temp_list = list() - for i in files: - service = i.replace(".json", "") - temp_list.append(service) - - services = "、".join(map(str, temp_list)) + services = list() + for f in files: + prefix = f.replace(".json", "") + f = os.path.join(SERVICES_DIR, f) + with open(f, "r", encoding="utf-8") as r: + service = json.load(r) + services.append([prefix, "√" if service["enabled"] else "×", "√" if service["only_admin"] else "×"]) + table = tabulate(services, headers=["服务名称", "开启状态", "仅支持管理员"], tablefmt="plain", showindex=True) + output = f"咱搭载了以下服务~\n{table}\n@bot 帮助 [服务] -以查看对应服务帮助" Message = make_fake_message() @@ -91,7 +96,7 @@ async def test_service_list(app: App): event, f""" 咱搭载了以下服务~ - {services} + {output} @bot 帮助 [服务] -以查看对应服务帮助 """, True, -- cgit v1.2.3