mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-10-30 20:05:42 +08:00
* fix(indexer): 站点资源页页码归一化并让 mTorrent/HDDolby/Yema 支持分类透传 站点资源页传 1 起始页码,链路按 0 起始处理,mTorrent 再 +1 后请求 pageNumber=2, 导致单页关键词搜索返回空;同时站点页选择的分类没有透传到专站适配器, Movie/TV 预置分类互相覆盖,分类筛选不生效。 - site.py: page 传入前归一化为 max(page-1, 0) - indexer: mTorrent/HDDolby/Yema 专站参数补充 cat - mtorrent.py: search/async_search/__get_params 支持 cat,显式分类优先 - hddolby.py: search/async_search/__get_params 支持 cat,显式分类优先 - yema.py: search/async_search/_prepare_search_requests 支持 cat,显式分类优先 * fix(indexer): preserve browse paging and support category lists --------- Co-authored-by: GuanAllen <guanyelin@users.noreply.github.com> Co-authored-by: jxxghp <jxxghp@gmail.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
"""
|
|
验证站点浏览接口保留零起始页码和多选分类。
|
|
"""
|
|
|
|
import asyncio
|
|
from types import SimpleNamespace
|
|
from unittest.mock import AsyncMock
|
|
|
|
import pytest
|
|
|
|
from app.api.endpoints import site as site_endpoint
|
|
|
|
|
|
@pytest.mark.parametrize("page", [0, 1, 2])
|
|
def test_site_resource_preserves_zero_based_pages_and_categories(monkeypatch, page):
|
|
"""
|
|
第一页与后续页必须保持独立偏移,多选分类原样交给浏览链路。
|
|
"""
|
|
query = SimpleNamespace(get=AsyncMock(return_value=SimpleNamespace(domain="https://site.example/")))
|
|
torrent = SimpleNamespace(to_dict=lambda: {"title": "命中资源"})
|
|
browse = AsyncMock(return_value=[torrent])
|
|
monkeypatch.setattr(site_endpoint, "TorrentsChain", lambda: SimpleNamespace(async_browse=browse))
|
|
|
|
result = asyncio.run(site_endpoint.site_resource(
|
|
site_id=1, keyword="关键词", cat="401,402", page=page, query=query,
|
|
))
|
|
|
|
assert result == [{"title": "命中资源"}]
|
|
query.get.assert_awaited_once_with(1)
|
|
browse.assert_awaited_once_with(
|
|
domain="https://site.example/", keyword="关键词", cat="401,402", page=page, mtype=None,
|
|
)
|