mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
fix bugs
This commit is contained in:
@@ -28,8 +28,12 @@ def arknights_list_1():
|
||||
async def test_fetch_new(arknights, dummy_user_subinfo, arknights_list_0, arknights_list_1):
|
||||
ak_list_router = respx.get("https://ak-conf.hypergryph.com/config/prod/announce_meta/IOS/announcement.meta.json")
|
||||
detail_router = respx.get("https://ak-fs.hypergryph.com/announce/IOS/announcement/675.html")
|
||||
version_router = respx.get('https://ak-conf.hypergryph.com/config/prod/official/IOS/version')
|
||||
preannouncement_router = respx.get('https://ak-conf.hypergryph.com/config/prod/announce_meta/IOS/preannouncement.meta.json')
|
||||
ak_list_router.mock(return_value=Response(200, json=arknights_list_0))
|
||||
detail_router.mock(return_value=Response(200, text=get_file('arknights-detail-675.html')))
|
||||
version_router.mock(return_value=Response(200, json=get_json('arknights-version-0.json')))
|
||||
preannouncement_router.mock(return_value=Response(200, json=get_json('arknights-pre-0.json')))
|
||||
target = ''
|
||||
res = await arknights.fetch_new_post(target, [dummy_user_subinfo])
|
||||
assert(ak_list_router.called)
|
||||
|
||||
@@ -259,12 +259,12 @@ def mock_status_change(plugin_module: 'nonebot_hk_reporter'):
|
||||
else:
|
||||
return {'s': False}
|
||||
|
||||
def compare_status(self, target, old_status, new_status) -> Optional['RawPost']:
|
||||
def compare_status(self, target, old_status, new_status) -> list['RawPost']:
|
||||
if old_status['s'] == False and new_status['s'] == True:
|
||||
return {'text': 'on', 'cat': 1}
|
||||
return [{'text': 'on', 'cat': 1}]
|
||||
elif old_status['s'] == True and new_status['s'] == False:
|
||||
return {'text': 'off', 'cat': 2}
|
||||
return None
|
||||
return [{'text': 'off', 'cat': 2}]
|
||||
return []
|
||||
|
||||
async def parse(self, raw_post) -> 'Post':
|
||||
return plugin_module.post.Post('mock_status', raw_post['text'], '')
|
||||
|
||||
Reference in New Issue
Block a user