mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-21 00:07:32 +08:00
fix(agent): preserve episode lock on unchanged totals (#6271)
This commit is contained in:
35
tests/test_agent_query_subscribes.py
Normal file
35
tests/test_agent_query_subscribes.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import asyncio
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from app.agent.tools.impl.query_subscribes import QuerySubscribesTool
|
||||
from app.db.models.subscribe import Subscribe
|
||||
from app.schemas.types import MediaType
|
||||
|
||||
|
||||
def test_agent_query_subscribes_returns_manual_total_episode():
|
||||
"""订阅查询应返回手动总集数标记,供 Agent 判断元数据是否可自动刷新。"""
|
||||
subscribe = Subscribe(
|
||||
id=160,
|
||||
name="测试剧集",
|
||||
type=MediaType.TV.value,
|
||||
tmdbid=224839,
|
||||
season=1,
|
||||
total_episode=175,
|
||||
manual_total_episode=1,
|
||||
state="P",
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.agent.tools.impl.query_subscribes.SubscribeOper.async_list",
|
||||
return_value=[subscribe],
|
||||
):
|
||||
result = asyncio.run(
|
||||
QuerySubscribesTool(session_id="session-1", user_id="10001").run(
|
||||
tmdb_id=224839,
|
||||
)
|
||||
)
|
||||
|
||||
_, result_json = result.split("\n\n", maxsplit=1)
|
||||
payload = json.loads(result_json)
|
||||
assert payload[0]["manual_total_episode"] == 1
|
||||
Reference in New Issue
Block a user