mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-01 12:56:34 +08:00
test(plugin): align local source projection contract
This commit is contained in:
@@ -222,8 +222,8 @@ def test_local_scan_preserves_absent_present_and_failed_states() -> None:
|
||||
assert failed.local_read.error == "local repository unavailable"
|
||||
|
||||
|
||||
def test_local_candidates_never_expose_path_in_inventory_projection() -> None:
|
||||
"""本地候选可参与库存,但公共投影永不携带本地仓库路径。"""
|
||||
def test_local_candidates_keep_source_marker_in_inventory_projection() -> None:
|
||||
"""本地候选可参与库存,并保留可供来源选择使用的来源标识。"""
|
||||
reader = PluginCandidateInventoryReader(
|
||||
market_loader=lambda *_args: {},
|
||||
local_candidate_loader=lambda: {
|
||||
@@ -244,10 +244,10 @@ def test_local_candidates_never_expose_path_in_inventory_projection() -> None:
|
||||
assert public["local_candidates"] == [{
|
||||
"plugin_id": "LocalPlugin",
|
||||
"source_type": "local",
|
||||
"repo_url": "local://LocalPlugin?path=/private/local&version=v3",
|
||||
"package_generation": "v3",
|
||||
"plugin_version": "3.0.0",
|
||||
}]
|
||||
assert "/private/local" not in str(public)
|
||||
|
||||
|
||||
def test_invalid_local_candidate_does_not_abort_online_inventory() -> None:
|
||||
|
||||
@@ -322,8 +322,8 @@ def test_first_local_payload_creates_local_only_identity() -> None:
|
||||
assert target.trusted_source_type is TrustedPluginSourceType.UNKNOWN
|
||||
|
||||
|
||||
def test_sanitized_local_reference_selects_configured_candidate_without_path() -> None:
|
||||
"""脱敏本地来源标识仍能选择配置内候选,但公共投影不暴露路径。"""
|
||||
def test_local_reference_selects_configured_candidate_with_source_marker() -> None:
|
||||
"""本地来源标识仍能选择配置内候选,并保留可回传的来源标识。"""
|
||||
local = PluginLocalCandidate(
|
||||
plugin_id="DemoPlugin",
|
||||
repo_url=(
|
||||
@@ -350,10 +350,10 @@ def test_sanitized_local_reference_selects_configured_candidate_without_path() -
|
||||
assert public == {
|
||||
"plugin_id": "DemoPlugin",
|
||||
"source_type": "local",
|
||||
"repo_url": "local://DemoPlugin?path=/private/secret/plugins&version=v3",
|
||||
"package_generation": "v3",
|
||||
"plugin_version": "2.0.0-dev",
|
||||
}
|
||||
assert "/private/secret/plugins" not in str(public)
|
||||
|
||||
|
||||
def test_legacy_identity_can_bind_explicit_online_source() -> None:
|
||||
|
||||
Reference in New Issue
Block a user