Add metadata validation for missing backup files in OneDrive backup agent (#163072)

This commit is contained in:
Josef Zweck
2026-02-18 23:32:23 +01:00
committed by GitHub
parent 6be1e4065f
commit c7276621eb
3 changed files with 41 additions and 1 deletions

View File

@@ -157,6 +157,31 @@ async def test_agents_get_backup(
}
async def test_agents_get_backup_missing_file(
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,
mock_config_entry: MockConfigEntry,
mock_onedrive_client: MagicMock,
mock_metadata_file: File,
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test what happens when only metadata exists."""
mock_onedrive_client.list_drive_items.return_value = [mock_metadata_file]
backup_id = BACKUP_METADATA["backup_id"]
client = await hass_ws_client(hass)
await client.send_json_auto_id({"type": "backup/details", "backup_id": backup_id})
response = await client.receive_json()
assert response["success"]
assert response["result"]["agent_errors"] == {}
assert response["result"]["backup"] is None
assert (
"Backup file 23e64aec.tar not found for metadata 23e64aec.metadata.json"
in caplog.text
)
async def test_agents_delete(
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,