Show Windows Agent status on AI structure page
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-22 01:05:09 +03:00
parent d93b7cb07e
commit e12332d3c6
4 changed files with 110 additions and 0 deletions
+38
View File
@@ -2071,6 +2071,44 @@ def test_html5_ai_structure_reports_offline_agent_with_last_seen(tmp_path: Path)
assert "Последний heartbeat" in queued.text
def test_html5_ai_structure_page_shows_agent_status_panel():
client = TestClient(app)
project_id = f"ai-page-{uuid4()}"
agent_id = f"win-agent-{uuid4()}"
settings = client.post(
f"/projects/{project_id}/settings",
json={"name": "AI Page", "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", "version": "0.2.31"})
assert heartbeat.status_code == 200
page = client.get(f"/html5/projects/{project_id}/ai-structure")
assert page.status_code == 200
assert "Агент для CF/CFE" in page.text
assert "агент онлайн" in page.text
assert agent_id in page.text
assert "test-host" in page.text
assert "0.2.31" in page.text
def test_html5_ai_structure_page_shows_missing_agent_hint():
client = TestClient(app)
project_id = f"ai-page-missing-{uuid4()}"
settings = client.post(
f"/projects/{project_id}/settings",
json={"name": "AI Page Missing", "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 "Укажите его в настройках проекта" in page.text
def test_import_full_replace_replaces_current_normalized_project(tmp_path: Path):
first = tmp_path / "first"
second = tmp_path / "second"