mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
✨ 独立 bilibili-live 的 SchedConf (#473)
* ✨ 独立 bilibili-live 的 SchedConf * ✅ 修正测试 * ✨ bilibili和bilibili-live共用http_client * 🐛 不在__init__中修改_client_refresh_time * ✨ 将刷新浏览器变更为类方法 * ♻️ seperate BilibiliClient Co-authored-by: felinea98 <me@felinae98.cn> --------- Co-authored-by: felinea98 <me@felinae98.cn>
This commit is contained in:
@@ -30,6 +30,27 @@ def dummy_only_open_user_subinfo(app: App):
|
||||
return UserSubInfo(user=user, categories=[1], tags=[])
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_http_client_equal(app: App):
|
||||
from nonebot_bison.types import Target
|
||||
from nonebot_bison.utils import ProcessContext
|
||||
from nonebot_bison.platform import platform_manager
|
||||
|
||||
empty_target = Target("0")
|
||||
|
||||
bilibili = platform_manager["bilibili"](ProcessContext(), AsyncClient())
|
||||
bilibili_live = platform_manager["bilibili-live"](ProcessContext(), AsyncClient())
|
||||
|
||||
bilibili_scheduler = bilibili.scheduler()
|
||||
bilibili_live_scheduler = bilibili_live.scheduler()
|
||||
|
||||
assert await bilibili_scheduler.get_client(empty_target) == await bilibili_live_scheduler.get_client(empty_target)
|
||||
assert await bilibili_live_scheduler.get_client(empty_target) != bilibili_live_scheduler.default_http_client
|
||||
|
||||
assert await bilibili_scheduler.get_query_name_client() == await bilibili_live_scheduler.get_query_name_client()
|
||||
assert await bilibili_scheduler.get_query_name_client() != bilibili_live_scheduler.default_http_client
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@respx.mock
|
||||
async def test_fetch_bililive_no_room(bili_live, dummy_only_open_user_subinfo):
|
||||
|
||||
Reference in New Issue
Block a user