fix: 一次保存学习配置,改代理后重开任务
This commit is contained in:
@@ -290,8 +290,18 @@ def test_admin_can_probe_one_and_all_proxies(monkeypatch) -> None:
|
||||
assert single.json()["status"] == "alive"
|
||||
bulk = client.post("/api/admin/proxies/probe", json={"ids": [two.id]})
|
||||
assert bulk.status_code == 200
|
||||
assert bulk.json()["count"] == 1
|
||||
assert bulk.json()["items"][0]["latency_ms"] == 654
|
||||
assert bulk.json()["running"] is True
|
||||
finished = {"running": True}
|
||||
for _ in range(40):
|
||||
finished = client.get("/api/admin/proxies/probe").json()
|
||||
if finished["running"] is False:
|
||||
break
|
||||
import time
|
||||
time.sleep(0.05)
|
||||
assert finished["running"] is False
|
||||
listed = client.get("/api/admin/proxies").json()
|
||||
probed = next(item for item in listed["items"] if item["id"] == two.id)
|
||||
assert probed["latency_ms"] == 654
|
||||
missing = client.post("/api/admin/proxies/99999/probe")
|
||||
assert missing.status_code == 404
|
||||
|
||||
@@ -318,7 +328,7 @@ def test_admin_proxy_page_and_pool_assignment() -> None:
|
||||
assert body["items"][0]["host"] == "10.0.0.5"
|
||||
assert body["items"][0]["status_text"] == "可用"
|
||||
saved = client.put(
|
||||
"/api/admin/users/proxy",
|
||||
"/api/admin/users/study-settings",
|
||||
json={"employee_ids": ["a-user", "b-user"], "scheme": "pool"},
|
||||
)
|
||||
assert saved.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user