diff options
author | Kyomotoi <[email protected]> | 2022-02-18 23:06:17 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2022-02-18 23:06:17 +0800 |
commit | 774d9362282513ddd0cd3fbeaf8f46f4ba452053 (patch) | |
tree | ddd35eaa525247cd7caf75d74275dec5d3be8257 /test | |
parent | e7ff55fa0b39805ec759afd5b06c666538f5c7f1 (diff) | |
parent | c9f78dad4e823c99119b274ef0cd95512d80d5d7 (diff) | |
download | ATRI-774d9362282513ddd0cd3fbeaf8f46f4ba452053.tar.gz ATRI-774d9362282513ddd0cd3fbeaf8f46f4ba452053.tar.bz2 ATRI-774d9362282513ddd0cd3fbeaf8f46f4ba452053.zip |
⚡️🎨 Merge pull request #42 from Yuki-Asuuna/main
优化服务列表输出 & 去除scheduler Warning & 补充requirements.txt
Diffstat (limited to 'test')
-rw-r--r-- | test/test_plugin_help.py | 19 |
1 files changed, 12 insertions, 7 deletions
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, |