fix: 补齐审查清单里还没落地的交互和代理复测

This commit is contained in:
2026-11-16 16:17:31 +08:00
parent 58b3dedb2a
commit 50a8ae2e27
19 changed files with 444 additions and 192 deletions
+10 -3
View File
@@ -309,6 +309,9 @@ def test_admin_can_probe_one_and_all_proxies(monkeypatch) -> None:
def test_is_proxy_failure_detects_connect_errors() -> None:
assert is_proxy_failure(httpx.ConnectError("boom"))
assert is_proxy_failure(httpx.ConnectTimeout("late"))
assert is_proxy_failure(httpx.ReadTimeout("slow"))
assert is_proxy_failure(httpx.ReadError("reset"))
assert is_proxy_failure(httpx.RemoteProtocolError("bad"))
assert not is_proxy_failure(RuntimeError("登录需要重新验证"))
@@ -343,7 +346,7 @@ def test_admin_proxy_page_and_pool_assignment() -> None:
assert detail.json()["enabled"] is True
def test_user_can_enable_pool_proxy() -> None:
def test_user_can_enable_pool_proxy(monkeypatch) -> None:
import euniv.api as api_module
import euniv.service as service_module
@@ -386,8 +389,12 @@ def test_user_can_enable_pool_proxy() -> None:
def credential_alive(self) -> bool:
return True
api_module.login_and_store = lambda db, employee_id, password, manual=False, auto_attempts=3: service_module.login_and_store(
db, employee_id, password, FakeClient, manual=manual, auto_attempts=auto_attempts
monkeypatch.setattr(
api_module,
"login_and_store",
lambda db, employee_id, password, manual=False, auto_attempts=3: service_module.login_and_store(
db, employee_id, password, FakeClient, manual=manual, auto_attempts=auto_attempts
),
)
client = TestClient(api_module.app)
assert client.post("/api/login", json={"employee_id": "6650000146", "password": "secret-pass"}).status_code == 200