🔥 移除 mcbbsnews platform

This commit is contained in:
Azide
2024-02-20 15:31:12 +08:00
committed by felinae98
parent 2a33d5143d
commit 700196c888
6 changed files with 0 additions and 13059 deletions
@@ -1,218 +0,0 @@
[
{
"url": "thread-1340927-1-1.html",
"title": "Minecraft Java版 1.19-pre1 发布",
"category": "Java版资讯",
"author": "希铁石z",
"id": "normalthread_1340927",
"date": 1652889600
},
{
"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
}
]
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-67
View File
@@ -1,67 +0,0 @@
import respx
import pytest
from flaky import flaky
from nonebug.app import App
from httpx import Response, AsyncClient
from .utils import get_file, get_json
@pytest.fixture()
def mcbbsnews(app: App):
from nonebot_bison.utils import ProcessContext
from nonebot_bison.platform import platform_manager
return platform_manager["mcbbsnews"](ProcessContext(), AsyncClient())
@pytest.fixture(scope="module")
def raw_post_list():
return get_json("mcbbsnews/mcbbsnews_raw_post_list_update.json")
@pytest.mark.asyncio
@pytest.mark.render
@respx.mock
@flaky(max_runs=3, min_passes=1)
async def test_fetch_new(mcbbsnews, dummy_user_subinfo, raw_post_list):
from nonebot_bison.post import Post
news_router = respx.get("https://www.mcbbs.net/forum-news-1.html")
news_router.mock(return_value=Response(200, text=get_file("mcbbsnews/mock/mcbbsnews_post_list_html-0.html")))
new_post = respx.get("https://www.mcbbs.net/thread-1340927-1-1.html")
new_post.mock(return_value=Response(200, text=get_file("mcbbsnews/mock/mcbbsnews_new_post_html.html")))
target = ""
res = await mcbbsnews.fetch_new_post(target, [dummy_user_subinfo])
assert news_router.called
assert len(res) == 0
news_router.mock(return_value=Response(200, text=get_file("mcbbsnews/mock/mcbbsnews_post_list_html-1.html")))
res1 = await mcbbsnews.fetch_new_post(target, [dummy_user_subinfo])
assert news_router.called
post: Post = res1[0][1][0]
raw_post = raw_post_list[0]
assert post.platform.name == "MCBBS幻翼块讯"
assert post.content == "{}\n\n└由 {} 发表".format(raw_post["title"], raw_post["author"])
assert post.url == "https://www.mcbbs.net/{}".format(raw_post["url"])
assert post.nickname == raw_post["category"]
assert post.images
assert len(post.images) == 1
@pytest.mark.asyncio
@pytest.mark.render
@respx.mock
@flaky(max_runs=3, min_passes=1)
async def test_news_render(mcbbsnews, dummy_user_subinfo):
new_post = respx.get("https://www.mcbbs.net/thread-1340927-1-1.html")
new_post.mock(return_value=Response(200, text=get_file("mcbbsnews/mock/mcbbsnews_new_post_html.html")))
pics = await mcbbsnews._news_render("https://www.mcbbs.net/thread-1340927-1-1.html", "#post_25849603")
assert len(pics) == 1
pics_err_on_assert = await mcbbsnews._news_render("", "##post_25849603")
assert len(pics_err_on_assert) == 2
pics_err_on_other = await mcbbsnews._news_render("https://www.mcbbs.net/thread-1340927-1-1.html", "#post_err")
assert len(pics_err_on_other) == 2