Switch AI structure HTML5 flow to XML exports
This commit is contained in:
@@ -1770,6 +1770,7 @@ def test_ai_structure_prepare_writes_ai_ready_package(tmp_path: Path):
|
||||
"Ожидаемый формат выгрузки 1С",
|
||||
"Конфигурация",
|
||||
"Без лишнего сырья",
|
||||
"Для этой страницы используется только XML-выгрузка 1С",
|
||||
"smb_username",
|
||||
"smb_password",
|
||||
"data-ai-structure-progress",
|
||||
@@ -2240,51 +2241,36 @@ 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():
|
||||
def test_html5_ai_structure_page_shows_xml_only_hint():
|
||||
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}},
|
||||
json={"name": "AI Page", "structure_source": "XML_DUMP"},
|
||||
)
|
||||
assert settings.status_code == 200
|
||||
heartbeat = client.post(
|
||||
"/agent/heartbeat",
|
||||
json={
|
||||
"agent_id": agent_id,
|
||||
"host": "test-host",
|
||||
"version": "0.2.31",
|
||||
"network_roots": [r"\\192.168.220.220\mst"],
|
||||
},
|
||||
)
|
||||
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
|
||||
assert r"\\192.168.220.220\mst" in page.text
|
||||
assert "Для этой страницы используется только XML-выгрузка 1С" in page.text
|
||||
assert "Агент для CF/CFE" not in page.text
|
||||
|
||||
|
||||
def test_html5_ai_structure_page_shows_missing_agent_hint():
|
||||
def test_html5_ai_structure_page_shows_xml_layout_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"},
|
||||
json={"name": "AI Page Missing", "structure_source": "XML_DUMP"},
|
||||
)
|
||||
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
|
||||
assert "Папка с XML-выгрузкой 1С" in page.text
|
||||
assert "Проверить структуру выгрузки" in page.text
|
||||
|
||||
|
||||
def test_html5_ai_structure_check_path_button_present():
|
||||
@@ -2292,12 +2278,12 @@ def test_html5_ai_structure_check_path_button_present():
|
||||
project_id = f"ai-path-button-{uuid4()}"
|
||||
settings = client.post(
|
||||
f"/projects/{project_id}/settings",
|
||||
json={"name": "AI Path Button", "structure_source": "CF_FILE"},
|
||||
json={"name": "AI Path Button", "structure_source": "XML_DUMP"},
|
||||
)
|
||||
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
|
||||
assert "/ai-structure/check-path" in page.text
|
||||
|
||||
|
||||
@@ -2389,6 +2375,28 @@ def test_html5_ai_structure_check_path_reports_xml_export_layout(tmp_path: Path)
|
||||
assert "Конфигурация + отдельные папки расширений" in checked.text
|
||||
assert "Главная папка: Конфигурация" in checked.text
|
||||
assert "Папки расширений: CRM" in checked.text
|
||||
assert "Первые файлы объектов: Конфигурация/metadata.xml, CRM/РасширениеCRM.mdo" in checked.text
|
||||
|
||||
|
||||
def test_html5_ai_structure_check_path_rejects_binary_input_for_xml_flow(tmp_path: Path):
|
||||
cf_input = tmp_path / "demo.cf"
|
||||
cf_input.write_bytes(b"binary-cf")
|
||||
client = TestClient(app)
|
||||
project_id = f"ai-xml-binary-{uuid4()}"
|
||||
|
||||
settings = client.post(
|
||||
f"/projects/{project_id}/settings",
|
||||
json={"name": "AI XML Only", "structure_source": "XML_DUMP"},
|
||||
)
|
||||
assert settings.status_code == 200
|
||||
|
||||
checked = client.post(
|
||||
f"/html5/projects/{project_id}/ai-structure/check-path",
|
||||
data={"input_path": str(cf_input)},
|
||||
)
|
||||
assert checked.status_code == 200
|
||||
assert "поддерживается только XML-выгрузка 1С" in checked.text
|
||||
assert "Конфигурация" in checked.text
|
||||
|
||||
|
||||
def test_import_full_replace_replaces_current_normalized_project(tmp_path: Path):
|
||||
|
||||
Reference in New Issue
Block a user