Files
fgl-aircon/tests/components/fglair/test_translations.py
T
petr.polezhaev 57ee555704 ha(H4): repair key_mismatch, диагностика для ESPHome, reconfigure, переводы
- repairs: issue key_mismatch (ERROR, fixable) при состоянии key_error,
  ConfirmRepairFlow, снятие issue при online/unload/remove
- config flow: async_step_reconfigure (меню, prefill ручной формы,
  unique_id_mismatch, update_reload_and_abort) — путь «перепровижинировать»
- diagnostics: config/esp_home (dsn/lanip_key/key_id/host для secrets.yaml)
  + esp_home_masked и redacted entry_data, runtime-снимок значений
  (raw/display) из кэша ядра
- translations: issues.key_mismatch (title/description/fix_flow) en/ru,
  abort unique_id_mismatch/reconfigure_successful; тест согласованности
  strings↔en↔ru
- FglairClient.events_dropped; mock_ac: параметр key_id в фикстуре
- тесты: diagnostics, repairs issue+fix-flow, reconfigure (успех/чужое
  устройство), translations (45 components)
2026-09-29 14:06:39 +03:00

30 lines
920 B
Python

"""Согласованность strings.json / translations en/ru."""
from __future__ import annotations
import json
import pathlib
ROOT = pathlib.Path(__file__).resolve().parents[3]
COMPONENT = ROOT / "custom_components" / "fglair"
def _keys(node, prefix: str = "") -> set[str]:
keys: set[str] = set()
if isinstance(node, dict):
for key, value in node.items():
keys.add(prefix + key)
keys |= _keys(value, prefix + key + ".")
return keys
def test_en_matches_strings():
strings = json.loads((COMPONENT / "strings.json").read_text())
english = json.loads((COMPONENT / "translations" / "en.json").read_text())
assert strings == english
def test_ru_covers_all_keys():
strings = json.loads((COMPONENT / "strings.json").read_text())
russian = json.loads((COMPONENT / "translations" / "ru.json").read_text())
assert _keys(strings) == _keys(russian)