feat(webui): 超级编导 0 条作品时说清是哪几个活动
Deploy VitePress site to Pages / build (push) Canceled after 0s
Deploy VitePress site to Pages / Deploy (push) Canceled after 0s

实测踩到:按 10-22~10-24 查返回「活动 4 个、作品 0 条」,看着像链接没取到。
那 4 个活动全是排期在未来的(10.26/10.27/10.28/10.29),还没人发布。活动名
里的日期只是名字,不是创建时间 —— 这句也写进空态里。
This commit is contained in:
2026-10-24 16:45:12 +08:00
parent 2b19808f6b
commit 1dca78b6db
4 changed files with 90 additions and 3 deletions
+43
View File
@@ -86,6 +86,49 @@ class TestPreview:
assert result["videos"] == 1
assert result["rows"][0]["aweme_id"] == AWEME_A
@pytest.mark.asyncio
async def test_matched_activities_explain_a_zero_video_result(self, monkeypatch):
"""活动建了但还没人发布 —— 0 条作品是真的,界面上得说得出是哪几个活动。
实测踩到过:运营按「10-22 ~ 10-24」查,返回 4 个活动、0 条作品,以为链接没取到。
那 4 个活动全是排期在未来的(10.26/10.27/10.28/10.29),当然还没有作品。
"""
async def fake_activities(token, client):
return [
{
"id": 9,
"title": "10.26 漫展",
"created_at": superdir._day_start(date(2026, 10, 22)) + 3600,
"total_count": 0,
"published_count": 0,
}
]
async def fake_videos(token, activity_id, client):
return []
async def fake_token(session, platform=superdir.adapters.PLATFORM_DY):
return "token"
monkeypatch.setattr(superdir, "_fetch_activities", fake_activities)
monkeypatch.setattr(superdir, "_fetch_videos", fake_videos)
monkeypatch.setattr(superdir, "get_token", fake_token)
result = await superdir.preview(None, "2026-10-22", "2026-10-24")
assert result["videos"] == 0
assert result["rows"] == []
assert result["matched_activities"] == [
{
"id": 9,
"title": "10.26 漫展",
"created_at": superdir._day_start(date(2026, 10, 22)) + 3600,
"total_count": 0,
"published_count": 0,
}
]
@pytest.mark.asyncio
async def test_unpublished_and_private_videos_are_skipped(self, monkeypatch):
async def fake_activities(token, client):