Commit ff33217
committed
test(e2e): cover every restore-mechanism gap in auto-backup suite
The prior e2e only proved end-to-end restore for the automation lane
(Group 1 REST upsert via ``upsert_automation_config``). This expands
coverage to every restore mechanism in ``backup_manager.py`` plus a
deliberately complex helper.
Group 1 (REST upsert, same shape as automation):
- script full loop (``upsert_script_config``)
- scene full loop (``upsert_scene_config``)
Group 2 (WebSocket update commands, different envelope per domain):
- input_boolean helper full loop (``input_boolean/update`` WS)
- schedule helper full loop — new ``TestComplexHelperCaptureRestore``
with multiple weekday arrays each holding multiple from/to time-range
objects. Asserts the captured snapshot preserves the nested list
shape verbatim (3 days × up to 3 ranges) before the restore runs the
full nested payload through ``schedule/update``.
- dashboard full loop (``lovelace/config/save`` WS)
- dashboard_resource full loop (``lovelace/resources/update`` WS,
``resource_id`` re-injection)
- label full loop (``config/label_registry/update`` WS)
- category full loop (``config/category_registry/update`` WS, composite
``<scope>:<category_id>`` entity_id splitting)
- zone full loop (``config/zone/update`` WS, ``id`` → ``zone_id`` key
rename on restore)
- area_or_floor full loop (``config/area_registry/update`` WS; same
mechanism covers the floor branch with a different registry name)
Group 3 (service-call restore, distinct mechanism):
- group full loop (``/api/services/group/set``)
- entity full loop (POST ``/api/states/<entity_id>``) — uses an existing
``light.bed_light`` testcontainer entity and toggles ``hidden``;
cleanly restores afterwards. Skips if the entity isn't on the rig.
Documented coverage gaps (added as a class with a no-op anchor so
pytest -v surfaces them visibly):
- calendar_event / todo_item: restore creates a new entry rather than
overwriting (uid/id mismatch by design — Group 3 service shape, but
not a true round-trip). Mechanically covered by group + entity above.
- integration: ``config_entries/disable`` needs a real integration
safely toggleable; default testcontainer integrations
(``frontend``, ``homeassistant``) are unsafe to disable. Unit-test
coverage stays in ``test_backup_manager.py``.
Each new full-loop test follows the established
``test_full_loop`` pattern from ``TestAutomationCaptureRestore``:
create → edit → list → (view for schedule) → restore (+ safety
backup assertion) → delete → cleanup.1 parent c93353e commit ff33217
1 file changed
Lines changed: 912 additions & 87 deletions
0 commit comments