Add comments as requested

This commit is contained in:
Erik
2026-02-13 12:45:52 +01:00
parent fcbef32091
commit 9fe4d37379
2 changed files with 10 additions and 1 deletions
+5 -1
View File
@@ -80,7 +80,11 @@ def mock_create_backup() -> Generator[AsyncMock]:
@pytest.fixture(name="mock_ha_version")
def mock_ha_version_fixture(hass: HomeAssistant) -> Generator[None]:
"""Mock HA version."""
"""Mock HA version.
The HA version is included in backup metadata. We mock it for the benefit
of tests that check the exact content of the metadata.
"""
with patch("homeassistant.components.backup.manager.HAVERSION", "2025.1.0"):
yield
+5
View File
@@ -133,14 +133,19 @@ def test_read_backup(backup_json_content: bytes, expected_backup: AgentBackup) -
@pytest.mark.parametrize(
("backup", "password", "validation_result"),
[
# Backup not protected, no password provided -> validation passes
(Path("backup_v2_compressed.tar"), None, True),
(Path("backup_v2_uncompressed.tar"), None, True),
# Backup not protected, password provided -> validation fails
(Path("backup_v2_compressed.tar"), "hunter2", False),
(Path("backup_v2_uncompressed.tar"), "hunter2", False),
# Backup protected, correct password provided -> validation passes
(Path("backup_v2_compressed_protected.tar"), "hunter2", True),
(Path("backup_v2_uncompressed_protected.tar"), "hunter2", True),
# Backup protected, no password provided -> validation fails
(Path("backup_v2_compressed_protected.tar"), None, False),
(Path("backup_v2_uncompressed_protected.tar"), None, False),
# Backup protected, wrong password provided -> validation fails
(Path("backup_v2_compressed_protected.tar"), "wrong_password", False),
(Path("backup_v2_uncompressed_protected.tar"), "wrong_password", False),
],