File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
nonebot_plugin_all4one/middlewares/onebot Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -95,11 +95,11 @@ async def send_message(
9595
9696 async def get_supported_actions (self , ** kwargs : Any ) -> List [str ]:
9797 _ = set ()
98- _ .update (self .supported_actions )
98+ _ .update (self ._supported_actions )
9999 _ .update (await self .bot .get_supported_actions (** kwargs ))
100100 return list (_ )
101101
102102 async def _call_api (self , api : str , ** kwargs : Any ) -> Any :
103- if api in self .supported_actions :
103+ if api in self ._supported_actions :
104104 return await getattr (self , api )(** kwargs )
105105 return await self .bot .call_api (api , ** kwargs )
Original file line number Diff line number Diff line change 1+ from nonebug import App
2+ from nonebot .adapters .onebot .v12 import Bot
3+
4+
5+ async def test_get_supported_action (app : App ):
6+ from nonebot_plugin_all4one .middlewares .onebot .v12 import Middleware
7+
8+ async with app .test_api () as ctx :
9+ bot = ctx .create_bot (base = Bot , impl = "test" , platform = "test" )
10+ middleware = Middleware (bot )
11+ ctx .should_call_api ("get_supported_actions" , {}, [])
12+ supported_actions = await middleware .get_supported_actions ()
13+ assert set (supported_actions ) == {
14+ "upload_file" ,
15+ "get_file" ,
16+ "get_supported_actions" ,
17+ "send_message" ,
18+ }
You can’t perform that action at this time.
0 commit comments