diff --git a/tests/platforms/static/mcbbsnew_raw_post_list.json b/tests/platforms/static/mcbbsnew_raw_post_list.json new file mode 100644 index 0000000..19eb457 --- /dev/null +++ b/tests/platforms/static/mcbbsnew_raw_post_list.json @@ -0,0 +1,210 @@ +[ + { + "url": "thread-1340080-1-1.html", + "title": "Mojang Status:服务器出现一些小问题", + "category": "快讯", + "author": "DreamVoid", + "id": "normalthread_1340080", + "date": 1652630400 + }, + { + "url": "thread-1339940-1-1.html", + "title": "kinbdogz 就近期荒野更新的风波发表看法", + "category": "快讯", + "author": "卡狗", + "id": "normalthread_1339940", + "date": 1652630400 + }, + { + "url": "thread-1339097-1-1.html", + "title": "Minecraft 基岩版 1.18.33 发布(仅 Switch)", + "category": "基岩版本资讯", + "author": "电量量", + "id": "normalthread_1339097", + "date": 1652457600 + }, + { + "url": "thread-1338607-1-1.html", + "title": "Minecraft Java版 22w19a 发布", + "category": "Java版本资讯", + "author": "寂华", + "id": "normalthread_1338607", + "date": 1652371200 + }, + { + "url": "thread-1338592-1-1.html", + "title": "Minecraft 基岩版 Beta & Preview 1.19.0.32/33 发布", + "category": "基岩版本资讯", + "author": "苦力怕553", + "id": "normalthread_1338592", + "date": 1652371200 + }, + { + "url": "thread-1338588-1-1.html", + "title": "请给我们一个真正的“荒野更新”", + "category": "时评", + "author": "斯乌", + "id": "normalthread_1338588", + "date": 1652371200 + }, + { + "url": "thread-1338496-1-1.html", + "title": "slicedlime:周三无快照,推迟至周四", + "category": "快讯", + "author": "橄榄Chan", + "id": "normalthread_1338496", + "date": 1652198400 + }, + { + "url": "thread-1336371-1-1.html", + "title": "Minecraft 基岩版 1.18.32 发布(仅 Android、NS)【新增 NS 平台】", + "category": "基岩版本资讯", + "author": "电量量", + "id": "normalthread_1336371", + "date": 1651766400 + }, + { + "url": "thread-1335897-1-1.html", + "title": "Minecraft 基岩版 Beta & Preview 1.19.0.30/31 发布", + "category": "基岩版本资讯", + "author": "AzureZeng", + "id": "normalthread_1335897", + "date": 1651680000 + }, + { + "url": "thread-1335891-1-1.html", + "title": "Minecraft Java版 22w18a 发布", + "category": "Java版本资讯", + "author": "Aurora_Feather", + "id": "normalthread_1335891", + "date": 1651680000 + }, + { + "url": "thread-1333196-1-1.html", + "title": "Minecraft 基岩版 Beta & Preview 1.19.0.28/29 发布", + "category": "基岩版本资讯", + "author": "希铁石z", + "id": "normalthread_1333196", + "date": 1651161600 + }, + { + "url": "thread-1332834-1-1.html", + "title": "Minecraft 基岩版 1.18.31 发布", + "category": "基岩版本资讯", + "author": "希铁石z", + "id": "normalthread_1332834", + "date": 1651075200 + }, + { + "url": "thread-1332811-1-1.html", + "title": "Minecraft Java版 22w17a 发布", + "category": "Java版本资讯", + "author": "卡狗", + "id": "normalthread_1332811", + "date": 1651075200 + }, + { + "url": "thread-1332424-1-1.html", + "title": "Mojang Status:正在寻找1.18.30更新问题的解决方案", + "category": "基岩快讯", + "author": "ArmorRush", + "id": "normalthread_1332424", + "date": 1650988800 + }, + { + "url": "thread-1329712-1-1.html", + "title": "Minecraft 基岩版 Beta & Preview 1.19.0.26/27 发布", + "category": "基岩版本资讯", + "author": "ArmorRush", + "id": "normalthread_1329712", + "date": 1650470400 + }, + { + "url": "thread-1329651-1-1.html", + "title": "Minecraft Java版 22w16b 发布", + "category": "Java版本资讯", + "author": "卡狗", + "id": "normalthread_1329651", + "date": 1650470400 + }, + { + "url": "thread-1329644-1-1.html", + "title": "Minecraft Java版 22w16a 发布", + "category": "Java版本资讯", + "author": "希铁石z", + "id": "normalthread_1329644", + "date": 1650470400 + }, + { + "url": "thread-1329335-1-1.html", + "title": "Minecraft 基岩版 1.18.30 发布", + "category": "基岩版本资讯", + "author": "ArmorRush", + "id": "normalthread_1329335", + "date": 1650384000 + }, + { + "url": "thread-1328892-1-1.html", + "title": "“海王” 杰森·莫玛 有望主演《我的世界》大电影", + "category": "快讯", + "author": "广药", + "id": "normalthread_1328892", + "date": 1650297600 + }, + { + "url": "thread-1327089-1-1.html", + "title": "Minecraft 基岩版 Beta & Preview 1.19.0.24/25 发布", + "category": "基岩版本资讯", + "author": "ArmorRush", + "id": "normalthread_1327089", + "date": 1649952000 + }, + { + "url": "thread-1326640-1-1.html", + "title": "Minecraft Java版 22w15a 发布", + "category": "Java版本资讯", + "author": "ArmorRush", + "id": "normalthread_1326640", + "date": 1649865600 + }, + { + "url": "thread-1323762-1-1.html", + "title": "Minecraft 基岩版 Beta & Preview 1.19.0.20 发布", + "category": "基岩版本资讯", + "author": "ArmorRush", + "id": "normalthread_1323762", + "date": 1649260800 + }, + { + "url": "thread-1323662-1-1.html", + "title": "Minecraft Java版 22w14a 发布", + "category": "Java版本资讯", + "author": "卡狗", + "id": "normalthread_1323662", + "date": 1649260800 + }, + { + "url": "thread-1321419-1-1.html", + "title": "[愚人节] Minecraft Java版 22w13oneBlockAtATime‎‎ 发布", + "category": "Java版本资讯", + "author": "希铁石z", + "id": "normalthread_1321419", + "date": 1648742400 + }, + { + "url": "thread-1320986-1-1.html", + "title": "Minecraft:近期没有为主机平台添加光线追踪的计划", + "category": "基岩快讯", + "author": "ArmorRush", + "id": "normalthread_1320986", + "date": 1648742400 + }, + { + "url": "thread-1320931-1-1.html", + "title": "Minecraft Java版 22w13a 发布", + "category": "Java版本资讯", + "author": "卡狗", + "id": "normalthread_1320931", + "date": 1648742400 + } +] diff --git a/tests/platforms/test_mcbbsnews.py b/tests/platforms/test_mcbbsnews.py new file mode 100644 index 0000000..6b3c921 --- /dev/null +++ b/tests/platforms/test_mcbbsnews.py @@ -0,0 +1,22 @@ +import pytest +import respx +from httpx import Response +from nonebug.app import App + +from .utils import get_file, get_json + + +@pytest.fixture +def mcbbsnews(app: App): + from nonebot_bison.platform import platform_manager + + return platform_manager['mcbbsnews'] + +@pytest.fixture(scope="module") +def raw_post_list(): + return get_json('mcbbsnews_raw_post_list.json') + +@pytest.mark.asyncio +async def test_javanews_parser(mcbbsnews,raw_post_list): + post = await mcbbsnews.parse(raw_post_list) + assert post.text=='' \ No newline at end of file