mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
test: align downloader file contract stub
This commit is contained in:
@@ -210,6 +210,19 @@ def _load_transmission_module():
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.__dict__.update(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):
|
class TorrentStatus(Enum):
|
||||||
TRANSFER = "transfer"
|
TRANSFER = "transfer"
|
||||||
DOWNLOADING = "downloading"
|
DOWNLOADING = "downloading"
|
||||||
@@ -271,6 +284,7 @@ def _load_transmission_module():
|
|||||||
schema_transfer_module.TransferTorrent = _TransferTorrent
|
schema_transfer_module.TransferTorrent = _TransferTorrent
|
||||||
schema_transfer_module.DownloadingTorrent = _DownloadingTorrent
|
schema_transfer_module.DownloadingTorrent = _DownloadingTorrent
|
||||||
schema_transfer_module.DownloaderTorrent = _DownloaderTorrent
|
schema_transfer_module.DownloaderTorrent = _DownloaderTorrent
|
||||||
|
schema_transfer_module.DownloaderFile = _DownloaderFile
|
||||||
schema_dashboard_module.DownloaderInfo = object
|
schema_dashboard_module.DownloaderInfo = object
|
||||||
schema_types_module.TorrentStatus = TorrentStatus
|
schema_types_module.TorrentStatus = TorrentStatus
|
||||||
schema_types_module.TorrentQueryStatus = TorrentQueryStatus
|
schema_types_module.TorrentQueryStatus = TorrentQueryStatus
|
||||||
|
|||||||
Reference in New Issue
Block a user