mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-03 18:06:13 +08:00
remove browser in ci
This commit is contained in:
parent
0a11499317
commit
42a4727c7e
@ -159,9 +159,9 @@ jobs:
|
||||
# - run: sed -e '41,45d' -i pyproject.toml
|
||||
- python/install-packages:
|
||||
pkg-manager: poetry
|
||||
- run:
|
||||
name: Install browser
|
||||
command: poetry run playwright install-deps && poetry run playwright install chromium
|
||||
# - run:
|
||||
# name: Install browser
|
||||
# command: poetry run playwright install-deps && poetry run playwright install chromium
|
||||
- run:
|
||||
name: Coverage test
|
||||
command: poetry run pytest --cov-report html --cov-report xml --cov=./src/plugins/nonebot_bison --junitxml=test-results/junit.xml
|
||||
|
24
tests/platforms/static/arknights-detail-807
Normal file
24
tests/platforms/static/arknights-detail-807
Normal file
@ -0,0 +1,24 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
||||
<meta name="keywords" content="明日方舟,明日方舟官网,明日方舟手游,二次元,明日方舟Arknights,魔物娘,战棋,策略,塔防,塔防RPG,Arknights,人外,Monster" />
|
||||
<meta name="description" content="《明日方舟》是一款魔物主题的策略手游。在游戏中,玩家将管理一艘满载“ 魔物干员”的方舟,为调查来源神秘的矿石灾难而踏上旅途。在这个宽广而危机四伏的世界中,你或许会看到废土中的城市废墟,或许会看到仿若幻境的亚人国度,或许会遭遇无法解读的神秘,或许参与无比残酷的战争。在有关幻想与异种生命的世界中,体验史诗与想象,情感与牵绊!" />
|
||||
<link rel="icon" href="data:;base64,=" />
|
||||
<title>公告</title>
|
||||
<link rel="stylesheet" href="../../assets/css/announcement.v_0_1_2.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="container">
|
||||
<div class="banner-image-container cover">
|
||||
<a class="cover-jumper" href="uniwebview://move?target=recruit&param1=NORM_24_0_1">
|
||||
<img class="banner-image" src="https://ak.hycdn.cn/announce/images/20211209/ff886833a69b48e513ff911f64f6d881.JPG" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
91
tests/platforms/static/arknights_list_-1.json
Normal file
91
tests/platforms/static/arknights_list_-1.json
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"focusAnnounceId": "816",
|
||||
"announceList": [
|
||||
{
|
||||
"announceId": "809",
|
||||
"title": "冰原信使系列\n新装限时上架",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/809_1640060505.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "810",
|
||||
"title": "寒武纪系列\n限时复刻上架",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/810_1640060511.html",
|
||||
"day": 21,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "806",
|
||||
"title": "跨年欢庆·回首\n限时寻访说明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/806_1639379808.html",
|
||||
"day": 14,
|
||||
"month": 12,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "802",
|
||||
"title": "「制作组通讯」\n#15期",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/802_1638871766.html",
|
||||
"day": 8,
|
||||
"month": 12,
|
||||
"group": "SYSTEM"
|
||||
},
|
||||
{
|
||||
"announceId": "97",
|
||||
"title": "新人寻访特惠\n必得六星干员",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/97_1606379786.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "95",
|
||||
"title": "通关特定关卡\n赠送专属时装",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/95_1606379781.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
},
|
||||
{
|
||||
"announceId": "192",
|
||||
"title": "《明日方舟》\n公测开启说明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/192_1606379744.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "SYSTEM"
|
||||
},
|
||||
{
|
||||
"announceId": "98",
|
||||
"title": "《明日方舟》\n公平运营申明",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/98_1638970453.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "SYSTEM"
|
||||
},
|
||||
{
|
||||
"announceId": "94",
|
||||
"title": "常驻活动介绍",
|
||||
"isWebUrl": true,
|
||||
"webUrl": "https://ak.hycdn.cn/announce/IOS/announcement/94_1606379757.html",
|
||||
"day": 30,
|
||||
"month": 4,
|
||||
"group": "ACTIVITY"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"enable": false,
|
||||
"name": "额外活动"
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,11 @@ def arknights_list_0():
|
||||
return get_json("arknights_list_0.json")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def arknights_list__1():
|
||||
return get_json("arknights_list_-1.json")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def arknights_list_1():
|
||||
return get_json("arknights_list_1.json")
|
||||
@ -36,6 +41,61 @@ def monster_siren_list_1():
|
||||
@pytest.mark.asyncio
|
||||
@respx.mock
|
||||
async def test_fetch_new(
|
||||
arknights,
|
||||
dummy_user_subinfo,
|
||||
arknights_list_0,
|
||||
arknights_list__1,
|
||||
monster_siren_list_0,
|
||||
monster_siren_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.hycdn.cn/announce/IOS/announcement/807_1640060583.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"
|
||||
)
|
||||
monster_siren_router = respx.get("https://monster-siren.hypergryph.com/api/news")
|
||||
ak_list_router.mock(return_value=Response(200, json=arknights_list__1))
|
||||
detail_router.mock(
|
||||
return_value=Response(200, text=get_file("arknights-detail-807"))
|
||||
)
|
||||
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"))
|
||||
)
|
||||
monster_siren_router.mock(return_value=Response(200, json=monster_siren_list_0))
|
||||
target = ""
|
||||
res = await arknights.fetch_new_post(target, [dummy_user_subinfo])
|
||||
assert ak_list_router.called
|
||||
assert len(res) == 0
|
||||
assert not detail_router.called
|
||||
mock_data = arknights_list_0
|
||||
ak_list_router.mock(return_value=Response(200, json=mock_data))
|
||||
res3 = await arknights.fetch_new_post(target, [dummy_user_subinfo])
|
||||
assert len(res3[0][1]) == 1
|
||||
assert detail_router.called
|
||||
post = res3[0][1][0]
|
||||
assert post.target_type == "arknights"
|
||||
assert post.text == ""
|
||||
assert post.url == ""
|
||||
assert post.target_name == "明日方舟游戏内公告"
|
||||
assert len(post.pics) == 1
|
||||
# assert(post.pics == ['https://ak-fs.hypergryph.com/announce/images/20210623/e6f49aeb9547a2278678368a43b95b07.jpg'])
|
||||
print(res3[0][1])
|
||||
r = await post.generate_messages()
|
||||
|
||||
|
||||
@pytest.mark.render
|
||||
@respx.mock
|
||||
async def test_send_with_render(
|
||||
arknights,
|
||||
dummy_user_subinfo,
|
||||
arknights_list_0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user