mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
refactor: unify transfer chain data ports
This commit is contained in:
@@ -543,6 +543,31 @@ def test_subscribe_chain_uses_explicit_data_port_getters():
|
||||
assert violations == []
|
||||
|
||||
|
||||
def test_transfer_chains_use_explicit_data_port_getters():
|
||||
"""整理主链与 mixin 不得把迁移期 PortProxy 伪装成数据库 Oper。"""
|
||||
paths = [APP_ROOT / "chain" / "transfer.py", APP_ROOT / "chain" / "_transfer.py"]
|
||||
forbidden = {
|
||||
"DownloadHistoryPortProxy",
|
||||
"TransferHistoryPortProxy",
|
||||
"TransferPendingPortProxy",
|
||||
}
|
||||
violations: list[str] = []
|
||||
for path in paths:
|
||||
tree = ast.parse(path.read_text(encoding="utf-8-sig"), filename=str(path))
|
||||
for node in ast.walk(tree):
|
||||
if not isinstance(node, ast.ImportFrom):
|
||||
continue
|
||||
if node.module != "app.application.chain.data":
|
||||
continue
|
||||
for alias in node.names:
|
||||
if alias.name in forbidden:
|
||||
violations.append(
|
||||
f"{path.relative_to(PROJECT_ROOT).as_posix()}:{node.lineno}:{alias.name}"
|
||||
)
|
||||
|
||||
assert violations == []
|
||||
|
||||
|
||||
def test_plugin_components_do_not_reexport_legacy_abi_names():
|
||||
"""新插件组件只提供 canonical 能力,不得复制旧 Helper、Manager 或 Oper 导出。"""
|
||||
violations: list[str] = []
|
||||
|
||||
@@ -59,12 +59,12 @@ def _patch_transfer_planning(monkeypatch, chain, fileitem, history, planned, del
|
||||
delete=lambda history_id: deleted.append(("history", history_id)),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: history_oper,
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: history_oper)
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: history_oper)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
@@ -72,7 +72,7 @@ def _patch_transfer_planning(monkeypatch, chain, fileitem, history, planned, del
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
|
||||
@@ -535,10 +535,10 @@ def test_success_file_aggregation_is_isolated_between_music_jobs_in_same_directo
|
||||
)
|
||||
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace())
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace())
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.add_transfer_success",
|
||||
lambda **kwargs: SimpleNamespace(id=1),
|
||||
@@ -767,8 +767,8 @@ def test_downloader_process_forwards_music_history_type(tmp_path, monkeypatch):
|
||||
],
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper.get_by_hash",
|
||||
lambda _, download_hash: history,
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(get_by_hash=lambda download_hash: history),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
chain,
|
||||
|
||||
@@ -137,7 +137,7 @@ class TestTransferFailedRetryButtons(unittest.TestCase):
|
||||
settings, "AI_AGENT_ENABLE", True
|
||||
):
|
||||
with patch(
|
||||
"app.chain._transfer.TransferHistoryOper"
|
||||
"app.chain._transfer.get_chain_transfer_history_port"
|
||||
) as history_oper_cls, patch(
|
||||
"app.chain._transfer.build_manual_redo_prompt",
|
||||
return_value="retry transfer prompt",
|
||||
@@ -217,7 +217,7 @@ class TestTransferFailedRetryButtons(unittest.TestCase):
|
||||
settings, "AI_AGENT_ENABLE", True
|
||||
):
|
||||
with patch(
|
||||
"app.chain._transfer.TransferHistoryOper"
|
||||
"app.chain._transfer.get_chain_transfer_history_port"
|
||||
) as history_oper_cls, patch(
|
||||
"app.chain._transfer.build_manual_redo_prompt",
|
||||
side_effect=build_manual_redo_prompt,
|
||||
|
||||
@@ -426,7 +426,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper", return_value=SimpleNamespace()
|
||||
"app.chain.transfer.get_chain_transfer_history_port", return_value=SimpleNamespace()
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_success",
|
||||
lambda **kwargs: SimpleNamespace(id=1),
|
||||
@@ -472,8 +472,8 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
)
|
||||
system_config_oper = SimpleNamespace(get=lambda key: None)
|
||||
|
||||
with patch("app.chain.transfer.TransferHistoryOper", return_value=transfer_history_oper), \
|
||||
patch("app.chain.transfer.DownloadHistoryOper", return_value=download_history_oper), \
|
||||
with patch("app.chain.transfer.get_chain_transfer_history_port", return_value=transfer_history_oper), \
|
||||
patch("app.chain.transfer.get_chain_download_history_port", return_value=download_history_oper), \
|
||||
patch("app.chain.transfer.get_configured_system_config", return_value=system_config_oper), \
|
||||
patch("app.chain.transfer.MetaInfoPath", lambda *args, **kwargs: FakeMeta(14)):
|
||||
state, errmsg = chain.do_transfer(
|
||||
@@ -647,7 +647,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
system_config_oper = SimpleNamespace(get=lambda key: None)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.get_configured_system_config",
|
||||
@@ -715,10 +715,10 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
_reset_failed_retries(fileitem.path, fileitem.storage)
|
||||
try:
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
return_value=download_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.get_configured_system_config",
|
||||
@@ -794,10 +794,10 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
):
|
||||
record_transfer_failure(fileitem.path, fileitem.storage)
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
return_value=download_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.get_configured_system_config",
|
||||
@@ -850,7 +850,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
)
|
||||
failed_history_oper = SimpleNamespace()
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=failed_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_fail",
|
||||
@@ -890,7 +890,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
need_notify=False,
|
||||
)
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper", return_value=SimpleNamespace()
|
||||
"app.chain.transfer.get_chain_transfer_history_port", return_value=SimpleNamespace()
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_success",
|
||||
lambda **kwargs: SimpleNamespace(id=2),
|
||||
@@ -920,7 +920,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
transfer_history_oper = SimpleNamespace()
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_fail",
|
||||
@@ -962,7 +962,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
self.assertTrue(chain.jobview.add_task(task))
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=SimpleNamespace(),
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_fail",
|
||||
@@ -1005,7 +1005,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
self.assertTrue(chain.jobview.add_task(task))
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=SimpleNamespace(),
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_fail",
|
||||
@@ -1081,10 +1081,10 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
return_value=download_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.get_configured_system_config",
|
||||
@@ -1180,10 +1180,10 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
storage_chain = SimpleNamespace(get_item=lambda fileitem: subtitle_fileitem)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
return_value=download_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.get_configured_system_config",
|
||||
@@ -1261,10 +1261,10 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
return_value=download_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.get_configured_system_config",
|
||||
@@ -1366,10 +1366,10 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
return_value=download_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.get_configured_system_config",
|
||||
@@ -1464,7 +1464,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
]
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper", return_value=SimpleNamespace()
|
||||
"app.chain.transfer.get_chain_transfer_history_port", return_value=SimpleNamespace()
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_success",
|
||||
lambda **kwargs: SimpleNamespace(id=1),
|
||||
@@ -1530,7 +1530,7 @@ class TransferJobManagerTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper", return_value=SimpleNamespace()
|
||||
"app.chain.transfer.get_chain_transfer_history_port", return_value=SimpleNamespace()
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_success",
|
||||
lambda **kwargs: SimpleNamespace(id=1),
|
||||
|
||||
@@ -104,10 +104,10 @@ def test_conflicting_download_history_recognizes_movie_by_file_meta(monkeypatch)
|
||||
try_remove_job=lambda task: None,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_type_tmdbid=lambda **kwargs: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_type_tmdbid=lambda **kwargs: None))
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_type_tmdbid=lambda **kwargs: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.MediaChain",
|
||||
lambda: SimpleNamespace(
|
||||
@@ -187,12 +187,12 @@ def test_movie_collection_conflict_only_drops_automatic_media(
|
||||
|
||||
chain._TransferChain__handle_transfer = fake_handle_transfer
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain.transfer.DownloadHistoryOper", lambda: history_oper)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: history_oper)
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain.transfer.get_chain_download_history_port", lambda: history_oper)
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: history_oper)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.get_configured_system_config",
|
||||
lambda: SimpleNamespace(get=lambda key: None),
|
||||
|
||||
@@ -153,7 +153,7 @@ def test_default_callback_skips_history_and_notification_when_overwrite_declined
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_fail",
|
||||
@@ -199,7 +199,7 @@ def test_default_callback_keeps_original_failure_semantics_without_success_histo
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_fail",
|
||||
@@ -251,7 +251,7 @@ def test_default_callback_delegates_primary_failure_to_durable_writer():
|
||||
|
||||
chain.durable_event_writer.transfer_result.side_effect = durable_transfer_result
|
||||
with patch(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
return_value=transfer_history_oper,
|
||||
), patch(
|
||||
"app.chain.transfer.add_transfer_fail",
|
||||
|
||||
@@ -139,12 +139,12 @@ def test_sync_extra_subtitle_inherits_matching_video_episode(monkeypatch):
|
||||
|
||||
monkeypatch.setattr(chain, "_TransferChain__handle_transfer", fake_handle_transfer)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
@@ -152,7 +152,7 @@ def test_sync_extra_subtitle_inherits_matching_video_episode(monkeypatch):
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
@@ -236,12 +236,12 @@ def test_single_subtitle_transfer_reuses_same_name_video_episode(monkeypatch):
|
||||
|
||||
monkeypatch.setattr(chain, "_TransferChain__handle_transfer", fake_handle_transfer)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
@@ -249,7 +249,7 @@ def test_single_subtitle_transfer_reuses_same_name_video_episode(monkeypatch):
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
@@ -351,12 +351,12 @@ def test_single_video_transfer_lists_parent_once_for_same_name_extra(monkeypatch
|
||||
|
||||
monkeypatch.setattr(chain, "_TransferChain__handle_transfer", fake_handle_transfer)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
@@ -364,7 +364,7 @@ def test_single_video_transfer_lists_parent_once_for_same_name_extra(monkeypatch
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
@@ -449,12 +449,12 @@ def test_episode_format_filters_extra_files_before_sync_planning(monkeypatch):
|
||||
|
||||
monkeypatch.setattr(chain, "_TransferChain__handle_transfer", fake_handle_transfer)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
@@ -462,7 +462,7 @@ def test_episode_format_filters_extra_files_before_sync_planning(monkeypatch):
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
@@ -536,12 +536,12 @@ def test_episode_format_keeps_matching_extra_files_following_main(monkeypatch):
|
||||
|
||||
monkeypatch.setattr(chain, "_TransferChain__handle_transfer", fake_handle_transfer)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
@@ -549,7 +549,7 @@ def test_episode_format_keeps_matching_extra_files_following_main(monkeypatch):
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
@@ -632,12 +632,12 @@ def test_single_matching_subtitle_uses_unmatched_video_only_as_context(monkeypat
|
||||
|
||||
monkeypatch.setattr(chain, "_TransferChain__handle_transfer", fake_handle_transfer)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
@@ -645,7 +645,7 @@ def test_single_matching_subtitle_uses_unmatched_video_only_as_context(monkeypat
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
@@ -728,12 +728,12 @@ def test_cleanup_dest_fileitem_is_deleted_only_after_allowed_items_exist(monkeyp
|
||||
|
||||
monkeypatch.setattr(chain, "_TransferChain__handle_transfer", fake_handle_transfer)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace(get_by_src=lambda src, storage=None: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
"app.chain.transfer.get_chain_download_history_port",
|
||||
lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
@@ -741,7 +741,7 @@ def test_cleanup_dest_fileitem_is_deleted_only_after_allowed_items_exist(monkeyp
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_download_history_port", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
|
||||
@@ -76,10 +76,10 @@ def test_transfer_stops_when_automatic_category_has_no_tmdb_result(monkeypatch)
|
||||
chain = object.__new__(TransferChain)
|
||||
chain.jobview = SimpleNamespace(try_remove_job=lambda _task: None)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
"app.chain.transfer.get_chain_transfer_history_port",
|
||||
lambda: SimpleNamespace(),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._transfer.TransferHistoryOper", lambda: SimpleNamespace())
|
||||
monkeypatch.setattr("app.chain._transfer.get_chain_transfer_history_port", lambda: SimpleNamespace())
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.MediaChain",
|
||||
lambda: SimpleNamespace(
|
||||
|
||||
Reference in New Issue
Block a user