diff --git a/tests/test_downloader_path_mapping.py b/tests/test_downloader_path_mapping.py index 2343a7eb4..acc513c7f 100644 --- a/tests/test_downloader_path_mapping.py +++ b/tests/test_downloader_path_mapping.py @@ -210,6 +210,19 @@ def _load_transmission_module(): def __init__(self, **kwargs): self.__dict__.update(kwargs) + class _DownloaderFile: + """隔离加载 Transmission 时提供下载器文件 DTO 的最小契约。""" + + @classmethod + def model_validate(cls, value): + """按生产 DTO 入口把 SDK 对象投影为测试快照。""" + if isinstance(value, cls): + return value + payload = value if isinstance(value, dict) else vars(value) + instance = cls() + instance.__dict__.update(payload) + return instance + class TorrentStatus(Enum): TRANSFER = "transfer" DOWNLOADING = "downloading" @@ -271,6 +284,7 @@ def _load_transmission_module(): schema_transfer_module.TransferTorrent = _TransferTorrent schema_transfer_module.DownloadingTorrent = _DownloadingTorrent schema_transfer_module.DownloaderTorrent = _DownloaderTorrent + schema_transfer_module.DownloaderFile = _DownloaderFile schema_dashboard_module.DownloaderInfo = object schema_types_module.TorrentStatus = TorrentStatus schema_types_module.TorrentQueryStatus = TorrentQueryStatus