feat: patrol delete

This commit is contained in:
koko
2026-04-27 00:23:44 +08:00
parent 5d8ee8fe79
commit 7f83bceba1
36 changed files with 4469 additions and 470 deletions

View File

@@ -106,15 +106,19 @@ def test_kill_process_uses_ziniao_driver(monkeypatch):
assert calls == [("init", {}), ("kill_process", "v6")]
def test_get_zinaio_exe_returns_none_when_winreg_unavailable(monkeypatch, caplog):
def test_get_zinaio_exe_returns_none_when_winreg_unavailable(monkeypatch):
driver = base.ZiniaoDriver({})
monkeypatch.setattr(base, "winreg", None)
messages = []
sink_id = base.logger.add(messages.append, level="ERROR", format="{message}")
with caplog.at_level("ERROR", logger=base.logger.name):
try:
result = driver.get_zinaio_exe()
finally:
base.logger.remove(sink_id)
assert result is None
assert any("winreg" in message for message in caplog.messages)
assert any("winreg" in message for message in messages)
@pytest.mark.parametrize(
@@ -250,7 +254,7 @@ def test_switching_countries_returns_true_when_already_current():
}
)
assert driver.SwitchingCountries("西班牙") is True
assert driver.switch_to_country("西班牙") is True
def test_switching_countries_returns_false_when_target_missing(monkeypatch):
@@ -268,7 +272,7 @@ def test_switching_countries_returns_false_when_target_missing(monkeypatch):
}
)
assert driver.SwitchingCountries("西班牙") is False
assert driver.switch_to_country("西班牙") is False
def test_switching_countries_clicks_and_verifies_target(monkeypatch):
@@ -292,7 +296,7 @@ def test_switching_countries_clicks_and_verifies_target(monkeypatch):
}
)
assert driver.SwitchingCountries("西班牙") is True
assert driver.switch_to_country("西班牙") is True
assert dropdown.clicks == 1
assert first_item.clicks == 1
assert target.clicks == 1