From 17c499ac2e096211dbb59ef6cd0b15ccdc22923a Mon Sep 17 00:00:00 2001 From: aicorein Date: Sun, 23 Feb 2025 18:49:50 +0800 Subject: [PATCH] [Test] Fix all tests --- tests/onebot/v11/test_handle.py | 9 ++------- tests/onebot/v11/test_io_duplex_http.py | 6 ++---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/onebot/v11/test_handle.py b/tests/onebot/v11/test_handle.py index a1e7922b..eb88f6b6 100644 --- a/tests/onebot/v11/test_handle.py +++ b/tests/onebot/v11/test_handle.py @@ -2,7 +2,7 @@ from asyncio import Queue, create_task from melobot.bot import Bot -from melobot.handle import GetParseArgs, on_start_match +from melobot.handle import on_start_match from melobot.log import GenericLogger from melobot.plugin import PluginPlanner from melobot.protocols.onebot.v11.adapter.base import Adapter @@ -55,12 +55,7 @@ @h -async def _flow( - bot: Bot, - event: MessageEvent, - logger: GenericLogger, - args: CmdArgs = GetParseArgs(), -) -> None: +async def _flow(bot: Bot, logger: GenericLogger, args: CmdArgs) -> None: logger.info(args) await bot.close() _SUCCESS_SIGNAL.set() diff --git a/tests/onebot/v11/test_io_duplex_http.py b/tests/onebot/v11/test_io_duplex_http.py index 8bbacff5..c674a88e 100644 --- a/tests/onebot/v11/test_io_duplex_http.py +++ b/tests/onebot/v11/test_io_duplex_http.py @@ -58,9 +58,7 @@ async def put_input(s: str): @singleton class MockClientSession: async def post(self, url, *args, **kwargs): - await _OUT_BUF.put( - json.dumps({"action": url.split("/")[-1], "params": kwargs["json"]}) - ) + await _OUT_BUF.put(json.dumps({"action": url.split("/")[-1], "params": kwargs["json"]})) resp = aiohttp.web.Response(status=200) resp.json = to_async(lambda: _TEST_ECHO_DICT | {"echo": _TEST_ACTION.id}) return resp @@ -73,7 +71,7 @@ async def test_http(monkeypatch) -> None: with LoggerCtx().unfold(Logger()): aiohttp._ClientSession = aiohttp.ClientSession monkeypatch.setattr(aiohttp, "ClientSession", lambda: MockClientSession()) - io = HttpIO("localhost", 8080, "localhost", 9090) + io = HttpIO("http://localhost:80", "localhost", 9090) create_task(put_input(json.dumps(_TEST_EVENT_DICT))) async with io: