from pathlib import Path import asyncio from hockey_data.agent_bridge import VmixAgentHub ROOT = Path(__file__).resolve().parents[1] JS = (ROOT / 'hockey_data/static/admin-directories.js').read_text(encoding='utf-8') BRIDGE = (ROOT / 'hockey_data/agent_bridge.py').read_text(encoding='utf-8') APP = (ROOT / 'app.py').read_text(encoding='utf-8') def test_agent_version_gates(): assert VmixAgentHub._agent_supports_mapping_inventory('1.2.4') is False assert VmixAgentHub._agent_supports_mapping_inventory('1.3.0') is True assert VmixAgentHub._agent_supports_mapping_inventory('1.4.0') is True assert VmixAgentHub._agent_supports_batch('1.3.9') is False assert VmixAgentHub._agent_supports_batch('1.4.0') is True def test_mapping_device_payload_exposes_version_support(): assert '"agent_version": row.agent_version or ""' in BRIDGE assert '"mapping_supported": self._agent_supports_mapping_inventory(row.agent_version)' in BRIDGE assert '"reason": "agent_mapping_unsupported"' in BRIDGE assert '"required_agent_version": "1.3.0"' in BRIDGE def test_mapping_editor_uses_resolved_profile_not_only_exact_fingerprint(): assert 'resolvedProfileId === profileId' in JS assert 'item.mapping_supported === false' in JS assert 'слишком старый для Mapping' in JS assert 'нужен 1.3.0+' in JS def test_runtime_version(): assert 'BUILD_VERSION = "2026.08.24.15"' in APP