Add AI structure agent path check
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-22 04:46:27 +03:00
parent b3689b1d9e
commit 2e86d25205
4 changed files with 197 additions and 0 deletions
+42
View File
@@ -2118,6 +2118,20 @@ def test_html5_ai_structure_page_shows_missing_agent_hint():
assert "Укажите его в настройках проекта" in page.text
def test_html5_ai_structure_check_path_button_present():
client = TestClient(app)
project_id = f"ai-path-button-{uuid4()}"
settings = client.post(
f"/projects/{project_id}/settings",
json={"name": "AI Path Button", "structure_source": "CF_FILE"},
)
assert settings.status_code == 200
page = client.get(f"/html5/projects/{project_id}/ai-structure")
assert page.status_code == 200
assert "Проверить путь у агента" in page.text
assert "/ai-structure/check-path" in page.text
def test_html5_ai_structure_reports_unc_root_mismatch_for_online_agent(tmp_path: Path):
cf_input = r"\\192.168.220.200\mst\1c\MARKA\CODEX\CF\demo.cf"
client = TestClient(app)
@@ -2154,6 +2168,34 @@ def test_html5_ai_structure_reports_unc_root_mismatch_for_online_agent(tmp_path:
assert r"\\192.168.220.220\mst" in queued.text
def test_html5_ai_structure_check_path_reports_root_mismatch():
client = TestClient(app)
project_id = f"ai-path-check-{uuid4()}"
agent_id = f"win-agent-{uuid4()}"
settings = client.post(
f"/projects/{project_id}/settings",
json={"name": "AI Path Check", "structure_source": "CF_FILE", "agent": {"cf_agent_id": agent_id}},
)
assert settings.status_code == 200
heartbeat = client.post(
"/agent/heartbeat",
json={
"agent_id": agent_id,
"host": "test-host",
"network_roots": [r"\\192.168.220.220\mst"],
},
)
assert heartbeat.status_code == 200
checked = client.post(
f"/html5/projects/{project_id}/ai-structure/check-path",
data={"input_path": r"\\192.168.220.200\mst\1c\MARKA\CODEX\CF\demo.cf"},
)
assert checked.status_code == 200
assert "Путь недоступен" in checked.text
assert "доступны только корни" in checked.text
def test_import_full_replace_replaces_current_normalized_project(tmp_path: Path):
first = tmp_path / "first"
second = tmp_path / "second"