190 build - улучшение работы всего сервиса. часть 1

This commit is contained in:
2026-10-21 13:23:38 +03:00
parent e4bedb1264
commit c6dcfcf533
44 changed files with 5391 additions and 0 deletions

View File

@@ -2,8 +2,16 @@ from __future__ import annotations
import asyncio
import json
<<<<<<< HEAD
import shutil
import subprocess
from pathlib import Path
import pytest
=======
from pathlib import Path
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
from sqlalchemy import select
from hockey_data.agent_bridge import VmixAgentHub
@@ -21,12 +29,48 @@ def test_mapping_config_list_is_compact_and_has_copy_action() -> None:
assert 'data-map-copy-profile="${item.id}"' in JS
assert 'title="Копировать конфиг"' in JS
assert '>⧉</button>' in JS
<<<<<<< HEAD
assert '${isCurrent ? "✓" : (isUsed ? "↻" : "▶")}' in JS
assert "Обновить мой Agent с v" in JS
assert "${escapeHtml(item.name)}" in JS and "${escapeHtml(item.created_by)}" in JS
=======
assert '${isUsed ? "✓" : "▶"}' in JS
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
assert 'hockey-map-profile-actions' in CSS
assert 'hockey-map-profile-icon' in CSS
assert 'width:28px;height:28px' in CSS
assert '/profiles/${profileId}/duplicate' in JS
assert 'Копия «${created.name}» создана' in JS
<<<<<<< HEAD
node = shutil.which("node")
if node is None:
pytest.skip("Node is required for the actual Mapping row renderer check")
script = r'''
const fs=require('node:fs'),vm=require('node:vm'),assert=require('node:assert/strict');
const source=fs.readFileSync(0,'utf8');
const escape=source.slice(source.indexOf(' const escapeHtml ='),source.indexOf(' const normalizeTeamColorHex ='));
const start=source.indexOf(' const profileButtons =');
const rows=source.slice(start,source.indexOf(' const loadErrors =',start));
function render(mapping){
return vm.runInNewContext(escape+'\n'+rows+'\nprofileButtons',{
profiles:[{id:42,version:2,name:'<img src=x onerror=alert(1)>',created_by:'"><svg/onload=alert(1)>',field_count:3}],
profile:{id:42},selectedDevice:mapping?{mapping}:null,
});
}
const current=render({source_profile_id:42,version:2});
assert.ok(current.includes('>✓</button>') && current.includes('is-used'));
const update=render({source_profile_id:42,version:1});
assert.ok(update.includes('>↻</button>') && update.includes('Обновить мой Agent с v1 до v2'));
assert.ok(render(null).includes('>▶</button>'));
for(const html of [current,update]){
assert.ok(!html.includes('<img') && !html.includes('<svg'));
assert.ok(html.includes('&lt;img') && html.includes('&quot;&gt;&lt;svg'));
}
'''
checked = subprocess.run([node, "-e", script], input=JS, text=True, capture_output=True, timeout=10)
assert checked.returncode == 0, checked.stderr
=======
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
def test_duplicate_creates_independent_inactive_profile_with_all_links(tmp_path: Path) -> None: