feat(telegram): candidate list/delete/clear commands
私聊新增 /candidate [页码](待决策列表)、/candi_del(标题按钮逐条删除,删后原地重建键盘、可翻页连续删)、/candi_clear(全部/待决策/取消)。重构 handle_callback 为前缀分派(cdel/cpage/cclr,保留 add/ign/blk/fav);repository 加 list_pending_candidates/delete_all_candidates;LibraryService 加 pending_candidates/delete_candidate/clear_candidates 并刷看板缓存。
This commit is contained in:
1 parent
c6790f0ba1
commit
4a9c37f2f3
9 files changed
+473
-23
No files matched your search
@@ -326,6 +326,33 @@ def test_ignore_and_blacklist():
|
||||
db.close()
|
||||
|
||||
|
||||
def test_candidate_admin_delete_and_clear():
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
db, repo, service = setup(tmp, FakeReadClient())
|
||||
try:
|
||||
add_candidate(repo, 1)
|
||||
add_candidate(repo, 2)
|
||||
add_candidate(repo, 3)
|
||||
repo.mark_candidate_decision(3, "rejected")
|
||||
|
||||
assert [c["aid"] for c in service.pending_candidates()] == [1, 2]
|
||||
|
||||
deleted = service.delete_candidate(2)
|
||||
assert deleted is not None and deleted["aid"] == 2
|
||||
assert repo.get_candidate(2) is None
|
||||
assert service.delete_candidate(999) is None
|
||||
|
||||
assert service.clear_candidates(pending_only=True) == 1
|
||||
assert repo.get_candidate(3) is not None # 已决策保留
|
||||
assert repo.get_candidate(1) is None
|
||||
|
||||
add_candidate(repo, 4)
|
||||
assert service.clear_candidates() == 2 # aid 3 + aid 4
|
||||
assert repo.list_candidates() == []
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
def main():
|
||||
test_ingest_candidate_added_and_snapshot()
|
||||
test_ingest_candidate_exists_and_missing()
|
||||
@@ -337,6 +364,7 @@ def main():
|
||||
test_manual_ingest_truncation()
|
||||
test_manual_ingest_invalid_bvid_message()
|
||||
test_ignore_and_blacklist()
|
||||
test_candidate_admin_delete_and_clear()
|
||||
print("OK: 入库、手动入库、忽略、拉黑测试全部通过")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user