1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-20 10:28:45 +00:00

Check password early on backup restore (#5519)

Introduce a validate password method which only peaks into the archive
to validate the password before starting the actual restore process.
This makes sure that a wrong password returns an error even when
restoring the backup in background.
This commit is contained in:
Stefan Agner
2024-12-31 13:58:12 +01:00
committed by GitHub
parent 61b37877be
commit c2f6e319f2
4 changed files with 70 additions and 16 deletions

View File

@@ -478,7 +478,7 @@ async def test_restore_immediate_errors(
with (
patch.object(Backup, "protected", new=PropertyMock(return_value=True)),
patch.object(Backup, "set_password", return_value=False),
patch.object(Backup, "validate_password", return_value=False),
):
resp = await api_client.post(
f"/backups/{mock_partial_backup.slug}/restore/partial",