Rename strategy backup to automatic backup (#133489)

* Rename strategy backup to automatic backup

* Update homeassistant/components/backup/config.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Erik Montnemery 2024-12-18 17:35:11 +01:00 committed by GitHub
parent a1558213c4
commit 5516f3609d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 330 additions and 330 deletions

View File

@ -33,8 +33,8 @@ class StoredBackupConfig(TypedDict):
"""Represent the stored backup config.""" """Represent the stored backup config."""
create_backup: StoredCreateBackupConfig create_backup: StoredCreateBackupConfig
last_attempted_strategy_backup: str | None last_attempted_automatic_backup: str | None
last_completed_strategy_backup: str | None last_completed_automatic_backup: str | None
retention: StoredRetentionConfig retention: StoredRetentionConfig
schedule: StoredBackupSchedule schedule: StoredBackupSchedule
@ -44,8 +44,8 @@ class BackupConfigData:
"""Represent loaded backup config data.""" """Represent loaded backup config data."""
create_backup: CreateBackupConfig create_backup: CreateBackupConfig
last_attempted_strategy_backup: datetime | None = None last_attempted_automatic_backup: datetime | None = None
last_completed_strategy_backup: datetime | None = None last_completed_automatic_backup: datetime | None = None
retention: RetentionConfig retention: RetentionConfig
schedule: BackupSchedule schedule: BackupSchedule
@ -59,12 +59,12 @@ class BackupConfigData:
include_folders = None include_folders = None
retention = data["retention"] retention = data["retention"]
if last_attempted_str := data["last_attempted_strategy_backup"]: if last_attempted_str := data["last_attempted_automatic_backup"]:
last_attempted = dt_util.parse_datetime(last_attempted_str) last_attempted = dt_util.parse_datetime(last_attempted_str)
else: else:
last_attempted = None last_attempted = None
if last_attempted_str := data["last_completed_strategy_backup"]: if last_attempted_str := data["last_completed_automatic_backup"]:
last_completed = dt_util.parse_datetime(last_attempted_str) last_completed = dt_util.parse_datetime(last_attempted_str)
else: else:
last_completed = None last_completed = None
@ -79,8 +79,8 @@ class BackupConfigData:
name=data["create_backup"]["name"], name=data["create_backup"]["name"],
password=data["create_backup"]["password"], password=data["create_backup"]["password"],
), ),
last_attempted_strategy_backup=last_attempted, last_attempted_automatic_backup=last_attempted,
last_completed_strategy_backup=last_completed, last_completed_automatic_backup=last_completed,
retention=RetentionConfig( retention=RetentionConfig(
copies=retention["copies"], copies=retention["copies"],
days=retention["days"], days=retention["days"],
@ -90,20 +90,20 @@ class BackupConfigData:
def to_dict(self) -> StoredBackupConfig: def to_dict(self) -> StoredBackupConfig:
"""Convert backup config data to a dict.""" """Convert backup config data to a dict."""
if self.last_attempted_strategy_backup: if self.last_attempted_automatic_backup:
last_attempted = self.last_attempted_strategy_backup.isoformat() last_attempted = self.last_attempted_automatic_backup.isoformat()
else: else:
last_attempted = None last_attempted = None
if self.last_completed_strategy_backup: if self.last_completed_automatic_backup:
last_completed = self.last_completed_strategy_backup.isoformat() last_completed = self.last_completed_automatic_backup.isoformat()
else: else:
last_completed = None last_completed = None
return StoredBackupConfig( return StoredBackupConfig(
create_backup=self.create_backup.to_dict(), create_backup=self.create_backup.to_dict(),
last_attempted_strategy_backup=last_attempted, last_attempted_automatic_backup=last_attempted,
last_completed_strategy_backup=last_completed, last_completed_automatic_backup=last_completed,
retention=self.retention.to_dict(), retention=self.retention.to_dict(),
schedule=self.schedule.to_dict(), schedule=self.schedule.to_dict(),
) )
@ -286,7 +286,7 @@ class BackupSchedule:
self._unschedule_next(manager) self._unschedule_next(manager)
now = dt_util.now() now = dt_util.now()
if (cron_event := self.cron_event) is None: if (cron_event := self.cron_event) is None:
seed_time = manager.config.data.last_completed_strategy_backup or now seed_time = manager.config.data.last_completed_automatic_backup or now
cron_event = self.cron_event = CronSim(cron_pattern, seed_time) cron_event = self.cron_event = CronSim(cron_pattern, seed_time)
next_time = next(cron_event) next_time = next(cron_event)
@ -316,7 +316,7 @@ class BackupSchedule:
include_homeassistant=True, # always include HA include_homeassistant=True, # always include HA
name=config_data.create_backup.name, name=config_data.create_backup.name,
password=config_data.create_backup.password, password=config_data.create_backup.password,
with_strategy_settings=True, with_automatic_settings=True,
) )
except Exception: # noqa: BLE001 except Exception: # noqa: BLE001
# another more specific exception will be added # another more specific exception will be added
@ -404,14 +404,14 @@ async def _delete_filtered_backups(
get_agent_errors, get_agent_errors,
) )
# only delete backups that are created by the backup strategy # only delete backups that are created with the saved automatic settings
backups = { backups = {
backup_id: backup backup_id: backup
for backup_id, backup in backups.items() for backup_id, backup in backups.items()
if backup.with_strategy_settings if backup.with_automatic_settings
} }
LOGGER.debug("Total strategy backups: %s", backups) LOGGER.debug("Total automatic backups: %s", backups)
filtered_backups = backup_filter(backups) filtered_backups = backup_filter(backups)

View File

@ -60,7 +60,7 @@ class ManagerBackup(AgentBackup):
agent_ids: list[str] agent_ids: list[str]
failed_agent_ids: list[str] failed_agent_ids: list[str]
with_strategy_settings: bool | None with_automatic_settings: bool | None
@dataclass(frozen=True, kw_only=True, slots=True) @dataclass(frozen=True, kw_only=True, slots=True)
@ -445,10 +445,10 @@ class BackupManager:
if (backup_id := agent_backup.backup_id) not in backups: if (backup_id := agent_backup.backup_id) not in backups:
if known_backup := self.known_backups.get(backup_id): if known_backup := self.known_backups.get(backup_id):
failed_agent_ids = known_backup.failed_agent_ids failed_agent_ids = known_backup.failed_agent_ids
with_strategy_settings = known_backup.with_strategy_settings with_automatic_settings = known_backup.with_automatic_settings
else: else:
failed_agent_ids = [] failed_agent_ids = []
with_strategy_settings = None with_automatic_settings = None
backups[backup_id] = ManagerBackup( backups[backup_id] = ManagerBackup(
agent_ids=[], agent_ids=[],
addons=agent_backup.addons, addons=agent_backup.addons,
@ -462,7 +462,7 @@ class BackupManager:
name=agent_backup.name, name=agent_backup.name,
protected=agent_backup.protected, protected=agent_backup.protected,
size=agent_backup.size, size=agent_backup.size,
with_strategy_settings=with_strategy_settings, with_automatic_settings=with_automatic_settings,
) )
backups[backup_id].agent_ids.append(agent_ids[idx]) backups[backup_id].agent_ids.append(agent_ids[idx])
@ -494,10 +494,10 @@ class BackupManager:
if backup is None: if backup is None:
if known_backup := self.known_backups.get(backup_id): if known_backup := self.known_backups.get(backup_id):
failed_agent_ids = known_backup.failed_agent_ids failed_agent_ids = known_backup.failed_agent_ids
with_strategy_settings = known_backup.with_strategy_settings with_automatic_settings = known_backup.with_automatic_settings
else: else:
failed_agent_ids = [] failed_agent_ids = []
with_strategy_settings = None with_automatic_settings = None
backup = ManagerBackup( backup = ManagerBackup(
agent_ids=[], agent_ids=[],
addons=result.addons, addons=result.addons,
@ -511,7 +511,7 @@ class BackupManager:
name=result.name, name=result.name,
protected=result.protected, protected=result.protected,
size=result.size, size=result.size,
with_strategy_settings=with_strategy_settings, with_automatic_settings=with_automatic_settings,
) )
backup.agent_ids.append(agent_ids[idx]) backup.agent_ids.append(agent_ids[idx])
@ -611,7 +611,7 @@ class BackupManager:
include_homeassistant: bool, include_homeassistant: bool,
name: str | None, name: str | None,
password: str | None, password: str | None,
with_strategy_settings: bool = False, with_automatic_settings: bool = False,
) -> NewBackup: ) -> NewBackup:
"""Create a backup.""" """Create a backup."""
new_backup = await self.async_initiate_backup( new_backup = await self.async_initiate_backup(
@ -623,7 +623,7 @@ class BackupManager:
include_homeassistant=include_homeassistant, include_homeassistant=include_homeassistant,
name=name, name=name,
password=password, password=password,
with_strategy_settings=with_strategy_settings, with_automatic_settings=with_automatic_settings,
) )
assert self._backup_finish_task assert self._backup_finish_task
await self._backup_finish_task await self._backup_finish_task
@ -640,14 +640,14 @@ class BackupManager:
include_homeassistant: bool, include_homeassistant: bool,
name: str | None, name: str | None,
password: str | None, password: str | None,
with_strategy_settings: bool = False, with_automatic_settings: bool = False,
) -> NewBackup: ) -> NewBackup:
"""Initiate generating a backup.""" """Initiate generating a backup."""
if self.state is not BackupManagerState.IDLE: if self.state is not BackupManagerState.IDLE:
raise HomeAssistantError(f"Backup manager busy: {self.state}") raise HomeAssistantError(f"Backup manager busy: {self.state}")
if with_strategy_settings: if with_automatic_settings:
self.config.data.last_attempted_strategy_backup = dt_util.now() self.config.data.last_attempted_automatic_backup = dt_util.now()
self.store.save() self.store.save()
self.async_on_backup_event( self.async_on_backup_event(
@ -663,7 +663,7 @@ class BackupManager:
include_homeassistant=include_homeassistant, include_homeassistant=include_homeassistant,
name=name, name=name,
password=password, password=password,
with_strategy_settings=with_strategy_settings, with_automatic_settings=with_automatic_settings,
) )
except Exception: except Exception:
self.async_on_backup_event( self.async_on_backup_event(
@ -683,7 +683,7 @@ class BackupManager:
include_homeassistant: bool, include_homeassistant: bool,
name: str | None, name: str | None,
password: str | None, password: str | None,
with_strategy_settings: bool, with_automatic_settings: bool,
) -> NewBackup: ) -> NewBackup:
"""Initiate generating a backup.""" """Initiate generating a backup."""
if not agent_ids: if not agent_ids:
@ -708,13 +708,13 @@ class BackupManager:
password=password, password=password,
) )
self._backup_finish_task = self.hass.async_create_task( self._backup_finish_task = self.hass.async_create_task(
self._async_finish_backup(agent_ids, with_strategy_settings), self._async_finish_backup(agent_ids, with_automatic_settings),
name="backup_manager_finish_backup", name="backup_manager_finish_backup",
) )
return new_backup return new_backup
async def _async_finish_backup( async def _async_finish_backup(
self, agent_ids: list[str], with_strategy_settings: bool self, agent_ids: list[str], with_automatic_settings: bool
) -> None: ) -> None:
if TYPE_CHECKING: if TYPE_CHECKING:
assert self._backup_task is not None assert self._backup_task is not None
@ -743,12 +743,12 @@ class BackupManager:
open_stream=written_backup.open_stream, open_stream=written_backup.open_stream,
) )
await written_backup.release_stream() await written_backup.release_stream()
if with_strategy_settings: if with_automatic_settings:
# create backup was successful, update last_completed_strategy_backup # create backup was successful, update last_completed_automatic_backup
self.config.data.last_completed_strategy_backup = dt_util.now() self.config.data.last_completed_automatic_backup = dt_util.now()
self.store.save() self.store.save()
self.known_backups.add( self.known_backups.add(
written_backup.backup, agent_errors, with_strategy_settings written_backup.backup, agent_errors, with_automatic_settings
) )
# delete old backups more numerous than copies # delete old backups more numerous than copies
@ -870,7 +870,7 @@ class KnownBackups:
backup["backup_id"]: KnownBackup( backup["backup_id"]: KnownBackup(
backup_id=backup["backup_id"], backup_id=backup["backup_id"],
failed_agent_ids=backup["failed_agent_ids"], failed_agent_ids=backup["failed_agent_ids"],
with_strategy_settings=backup["with_strategy_settings"], with_automatic_settings=backup["with_automatic_settings"],
) )
for backup in stored_backups for backup in stored_backups
} }
@ -883,13 +883,13 @@ class KnownBackups:
self, self,
backup: AgentBackup, backup: AgentBackup,
agent_errors: dict[str, Exception], agent_errors: dict[str, Exception],
with_strategy_settings: bool, with_automatic_settings: bool,
) -> None: ) -> None:
"""Add a backup.""" """Add a backup."""
self._backups[backup.backup_id] = KnownBackup( self._backups[backup.backup_id] = KnownBackup(
backup_id=backup.backup_id, backup_id=backup.backup_id,
failed_agent_ids=list(agent_errors), failed_agent_ids=list(agent_errors),
with_strategy_settings=with_strategy_settings, with_automatic_settings=with_automatic_settings,
) )
self._manager.store.save() self._manager.store.save()
@ -911,14 +911,14 @@ class KnownBackup:
backup_id: str backup_id: str
failed_agent_ids: list[str] failed_agent_ids: list[str]
with_strategy_settings: bool with_automatic_settings: bool
def to_dict(self) -> StoredKnownBackup: def to_dict(self) -> StoredKnownBackup:
"""Convert known backup to a dict.""" """Convert known backup to a dict."""
return { return {
"backup_id": self.backup_id, "backup_id": self.backup_id,
"failed_agent_ids": self.failed_agent_ids, "failed_agent_ids": self.failed_agent_ids,
"with_strategy_settings": self.with_strategy_settings, "with_automatic_settings": self.with_automatic_settings,
} }
@ -927,7 +927,7 @@ class StoredKnownBackup(TypedDict):
backup_id: str backup_id: str
failed_agent_ids: list[str] failed_agent_ids: list[str]
with_strategy_settings: bool with_automatic_settings: bool
class CoreBackupReaderWriter(BackupReaderWriter): class CoreBackupReaderWriter(BackupReaderWriter):

View File

@ -25,7 +25,7 @@ def async_register_websocket_handlers(hass: HomeAssistant, with_hassio: bool) ->
websocket_api.async_register_command(hass, handle_details) websocket_api.async_register_command(hass, handle_details)
websocket_api.async_register_command(hass, handle_info) websocket_api.async_register_command(hass, handle_info)
websocket_api.async_register_command(hass, handle_create) websocket_api.async_register_command(hass, handle_create)
websocket_api.async_register_command(hass, handle_create_with_strategy_settings) websocket_api.async_register_command(hass, handle_create_with_automatic_settings)
websocket_api.async_register_command(hass, handle_delete) websocket_api.async_register_command(hass, handle_delete)
websocket_api.async_register_command(hass, handle_restore) websocket_api.async_register_command(hass, handle_restore)
websocket_api.async_register_command(hass, handle_subscribe_events) websocket_api.async_register_command(hass, handle_subscribe_events)
@ -52,8 +52,8 @@ async def handle_info(
agent_id: str(err) for agent_id, err in agent_errors.items() agent_id: str(err) for agent_id, err in agent_errors.items()
}, },
"backups": list(backups.values()), "backups": list(backups.values()),
"last_attempted_strategy_backup": manager.config.data.last_attempted_strategy_backup, "last_attempted_automatic_backup": manager.config.data.last_attempted_automatic_backup,
"last_completed_strategy_backup": manager.config.data.last_completed_strategy_backup, "last_completed_automatic_backup": manager.config.data.last_completed_automatic_backup,
}, },
) )
@ -181,11 +181,11 @@ async def handle_create(
@websocket_api.require_admin @websocket_api.require_admin
@websocket_api.websocket_command( @websocket_api.websocket_command(
{ {
vol.Required("type"): "backup/generate_with_strategy_settings", vol.Required("type"): "backup/generate_with_automatic_settings",
} }
) )
@websocket_api.async_response @websocket_api.async_response
async def handle_create_with_strategy_settings( async def handle_create_with_automatic_settings(
hass: HomeAssistant, hass: HomeAssistant,
connection: websocket_api.ActiveConnection, connection: websocket_api.ActiveConnection,
msg: dict[str, Any], msg: dict[str, Any],
@ -202,7 +202,7 @@ async def handle_create_with_strategy_settings(
include_homeassistant=True, # always include HA include_homeassistant=True, # always include HA
name=config_data.create_backup.name, name=config_data.create_backup.name,
password=config_data.create_backup.password, password=config_data.create_backup.password,
with_strategy_settings=True, with_automatic_settings=True,
) )
connection.send_result(msg["id"], backup) connection.send_result(msg["id"], backup)

View File

@ -78,11 +78,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -110,8 +110,8 @@
}), }),
'backups': list([ 'backups': list([
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -139,8 +139,8 @@
}), }),
'backups': list([ 'backups': list([
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -168,8 +168,8 @@
}), }),
'backups': list([ 'backups': list([
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -197,8 +197,8 @@
}), }),
'backups': list([ 'backups': list([
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',

View File

@ -190,8 +190,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -225,8 +225,8 @@
'name': 'test-name', 'name': 'test-name',
'password': 'test-password', 'password': 'test-password',
}), }),
'last_attempted_strategy_backup': '2024-10-26T04:45:00+01:00', 'last_attempted_automatic_backup': '2024-10-26T04:45:00+01:00',
'last_completed_strategy_backup': '2024-10-26T04:45:00+01:00', 'last_completed_automatic_backup': '2024-10-26T04:45:00+01:00',
'retention': dict({ 'retention': dict({
'copies': 3, 'copies': 3,
'days': 7, 'days': 7,
@ -256,8 +256,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': 3, 'copies': 3,
'days': None, 'days': None,
@ -287,8 +287,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': '2024-10-27T04:45:00+01:00', 'last_attempted_automatic_backup': '2024-10-27T04:45:00+01:00',
'last_completed_strategy_backup': '2024-10-26T04:45:00+01:00', 'last_completed_automatic_backup': '2024-10-26T04:45:00+01:00',
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': 7, 'days': 7,
@ -318,8 +318,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -349,8 +349,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -379,8 +379,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -410,8 +410,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': 7, 'days': 7,
@ -442,8 +442,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': 7, 'days': 7,
@ -473,8 +473,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -504,8 +504,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': 7, 'days': 7,
@ -536,8 +536,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': 7, 'days': 7,
@ -567,8 +567,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -598,8 +598,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -630,8 +630,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -661,8 +661,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -692,8 +692,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -724,8 +724,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -755,8 +755,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -786,8 +786,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -818,8 +818,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -849,8 +849,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -884,8 +884,8 @@
'name': 'test-name', 'name': 'test-name',
'password': 'test-password', 'password': 'test-password',
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -920,8 +920,8 @@
'name': 'test-name', 'name': 'test-name',
'password': 'test-password', 'password': 'test-password',
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -951,8 +951,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -982,8 +982,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': 3, 'copies': 3,
'days': 7, 'days': 7,
@ -1014,8 +1014,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': 3, 'copies': 3,
'days': 7, 'days': 7,
@ -1045,8 +1045,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -1076,8 +1076,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -1108,8 +1108,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -1139,8 +1139,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -1170,8 +1170,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': 3, 'copies': 3,
'days': None, 'days': None,
@ -1202,8 +1202,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': 3, 'copies': 3,
'days': None, 'days': None,
@ -1233,8 +1233,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -1264,8 +1264,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': 7, 'days': 7,
@ -1296,8 +1296,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': 7, 'days': 7,
@ -1327,8 +1327,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -1358,8 +1358,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': 3, 'copies': 3,
'days': None, 'days': None,
@ -1390,8 +1390,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': 3, 'copies': 3,
'days': None, 'days': None,
@ -1421,8 +1421,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -1451,8 +1451,8 @@
'name': None, 'name': None,
'password': None, 'password': None,
}), }),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
'retention': dict({ 'retention': dict({
'copies': None, 'copies': None,
'days': None, 'days': None,
@ -1474,8 +1474,8 @@
}), }),
'backups': list([ 'backups': list([
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1500,8 +1500,8 @@
}), }),
'backups': list([ 'backups': list([
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1539,11 +1539,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1568,8 +1568,8 @@
}), }),
'backups': list([ 'backups': list([
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1607,11 +1607,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1660,11 +1660,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1697,11 +1697,11 @@
'name': 'Test 2', 'name': 'Test 2',
'protected': False, 'protected': False,
'size': 1, 'size': 1,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1745,11 +1745,11 @@
'name': 'Test 2', 'name': 'Test 2',
'protected': False, 'protected': False,
'size': 1, 'size': 1,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1788,11 +1788,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1841,11 +1841,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1895,11 +1895,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 13, 'size': 13,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -1950,11 +1950,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 13, 'size': 13,
'with_strategy_settings': False, 'with_automatic_settings': False,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2003,11 +2003,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 13, 'size': 13,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2056,11 +2056,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 13, 'size': 13,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2109,11 +2109,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 13, 'size': 13,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2163,11 +2163,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 13, 'size': 13,
'with_strategy_settings': False, 'with_automatic_settings': False,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2216,7 +2216,7 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
}), }),
'success': True, 'success': True,
@ -2254,7 +2254,7 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
}), }),
'success': True, 'success': True,
@ -2305,7 +2305,7 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
}), }),
'success': True, 'success': True,
@ -2344,7 +2344,7 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
}), }),
'success': True, 'success': True,
@ -2607,11 +2607,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2649,11 +2649,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2692,11 +2692,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2729,7 +2729,7 @@
'name': 'Test 2', 'name': 'Test 2',
'protected': False, 'protected': False,
'size': 1, 'size': 1,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
dict({ dict({
'addons': list([ 'addons': list([
@ -2756,11 +2756,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',
@ -2799,11 +2799,11 @@
'name': 'Test', 'name': 'Test',
'protected': False, 'protected': False,
'size': 0, 'size': 0,
'with_strategy_settings': None, 'with_automatic_settings': None,
}), }),
]), ]),
'last_attempted_strategy_backup': None, 'last_attempted_automatic_backup': None,
'last_completed_strategy_backup': None, 'last_completed_automatic_backup': None,
}), }),
'success': True, 'success': True,
'type': 'result', 'type': 'result',

View File

@ -260,8 +260,8 @@ async def test_async_initiate_backup(
assert result["result"] == { assert result["result"] == {
"backups": [], "backups": [],
"agent_errors": {}, "agent_errors": {},
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
} }
await ws_client.send_json_auto_id({"type": "backup/subscribe_events"}) await ws_client.send_json_auto_id({"type": "backup/subscribe_events"})
@ -424,8 +424,8 @@ async def test_async_initiate_backup_with_agent_error(
assert result["result"] == { assert result["result"] == {
"backups": [], "backups": [],
"agent_errors": {}, "agent_errors": {},
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
} }
await ws_client.send_json_auto_id({"type": "backup/subscribe_events"}) await ws_client.send_json_auto_id({"type": "backup/subscribe_events"})
@ -496,7 +496,7 @@ async def test_async_initiate_backup_with_agent_error(
"name": "Core 2025.1.0", "name": "Core 2025.1.0",
"protected": False, "protected": False,
"size": 123, "size": 123,
"with_strategy_settings": False, "with_automatic_settings": False,
} }
await ws_client.send_json_auto_id( await ws_client.send_json_auto_id(
@ -513,8 +513,8 @@ async def test_async_initiate_backup_with_agent_error(
assert result["result"] == { assert result["result"] == {
"agent_errors": {}, "agent_errors": {},
"backups": [expected_backup_data], "backups": [expected_backup_data],
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
} }
await hass.async_block_till_done() await hass.async_block_till_done()
@ -522,7 +522,7 @@ async def test_async_initiate_backup_with_agent_error(
{ {
"backup_id": "abc123", "backup_id": "abc123",
"failed_agent_ids": ["test.remote"], "failed_agent_ids": ["test.remote"],
"with_strategy_settings": False, "with_automatic_settings": False,
} }
] ]

View File

@ -55,8 +55,8 @@ DEFAULT_STORAGE_DATA: dict[str, Any] = {
"name": None, "name": None,
"password": None, "password": None,
}, },
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
"retention": { "retention": {
"copies": None, "copies": None,
"days": None, "days": None,
@ -276,7 +276,7 @@ async def test_delete(
{ {
"backup_id": "abc123", "backup_id": "abc123",
"failed_agent_ids": ["test.remote"], "failed_agent_ids": ["test.remote"],
"with_strategy_settings": False, "with_automatic_settings": False,
} }
] ]
}, },
@ -487,7 +487,7 @@ async def test_generate_calls_create(
"include_homeassistant": True, "include_homeassistant": True,
"name": None, "name": None,
"password": None, "password": None,
"with_strategy_settings": True, "with_automatic_settings": True,
}, },
), ),
( (
@ -509,7 +509,7 @@ async def test_generate_calls_create(
"include_homeassistant": True, "include_homeassistant": True,
"name": "test-name", "name": "test-name",
"password": "test-password", "password": "test-password",
"with_strategy_settings": True, "with_automatic_settings": True,
}, },
), ),
], ],
@ -522,7 +522,7 @@ async def test_generate_with_default_settings_calls_create(
create_backup_settings: dict[str, Any], create_backup_settings: dict[str, Any],
expected_call_params: dict[str, Any], expected_call_params: dict[str, Any],
) -> None: ) -> None:
"""Test backup/generate_with_strategy_settings calls async_initiate_backup.""" """Test backup/generate_with_automatic_settings calls async_initiate_backup."""
await setup_backup_integration(hass, with_hassio=False) await setup_backup_integration(hass, with_hassio=False)
client = await hass_ws_client(hass) client = await hass_ws_client(hass)
@ -540,7 +540,7 @@ async def test_generate_with_default_settings_calls_create(
return_value=NewBackup(backup_job_id="abc123"), return_value=NewBackup(backup_job_id="abc123"),
) as generate_backup: ) as generate_backup:
await client.send_json_auto_id( await client.send_json_auto_id(
{"type": "backup/generate_with_strategy_settings"} {"type": "backup/generate_with_automatic_settings"}
) )
result = await client.receive_json() result = await client.receive_json()
assert result["success"] assert result["success"]
@ -780,8 +780,8 @@ async def test_agents_info(
"password": "test-password", "password": "test-password",
}, },
"retention": {"copies": 3, "days": 7}, "retention": {"copies": 3, "days": 7},
"last_attempted_strategy_backup": "2024-10-26T04:45:00+01:00", "last_attempted_automatic_backup": "2024-10-26T04:45:00+01:00",
"last_completed_strategy_backup": "2024-10-26T04:45:00+01:00", "last_completed_automatic_backup": "2024-10-26T04:45:00+01:00",
"schedule": {"state": "daily"}, "schedule": {"state": "daily"},
}, },
}, },
@ -798,8 +798,8 @@ async def test_agents_info(
"password": None, "password": None,
}, },
"retention": {"copies": 3, "days": None}, "retention": {"copies": 3, "days": None},
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
"schedule": {"state": "never"}, "schedule": {"state": "never"},
}, },
}, },
@ -816,8 +816,8 @@ async def test_agents_info(
"password": None, "password": None,
}, },
"retention": {"copies": None, "days": 7}, "retention": {"copies": None, "days": 7},
"last_attempted_strategy_backup": "2024-10-27T04:45:00+01:00", "last_attempted_automatic_backup": "2024-10-27T04:45:00+01:00",
"last_completed_strategy_backup": "2024-10-26T04:45:00+01:00", "last_completed_automatic_backup": "2024-10-26T04:45:00+01:00",
"schedule": {"state": "never"}, "schedule": {"state": "never"},
}, },
}, },
@ -834,8 +834,8 @@ async def test_agents_info(
"password": None, "password": None,
}, },
"retention": {"copies": None, "days": None}, "retention": {"copies": None, "days": None},
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
"schedule": {"state": "mon"}, "schedule": {"state": "mon"},
}, },
}, },
@ -852,8 +852,8 @@ async def test_agents_info(
"password": None, "password": None,
}, },
"retention": {"copies": None, "days": None}, "retention": {"copies": None, "days": None},
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
"schedule": {"state": "sat"}, "schedule": {"state": "sat"},
}, },
}, },
@ -1022,7 +1022,7 @@ async def test_config_update_errors(
@pytest.mark.parametrize( @pytest.mark.parametrize(
( (
"command", "command",
"last_completed_strategy_backup", "last_completed_automatic_backup",
"time_1", "time_1",
"time_2", "time_2",
"attempted_backup_time", "attempted_backup_time",
@ -1154,7 +1154,7 @@ async def test_config_schedule_logic(
hass_storage: dict[str, Any], hass_storage: dict[str, Any],
create_backup: AsyncMock, create_backup: AsyncMock,
command: dict[str, Any], command: dict[str, Any],
last_completed_strategy_backup: str, last_completed_automatic_backup: str,
time_1: str, time_1: str,
time_2: str, time_2: str,
attempted_backup_time: str, attempted_backup_time: str,
@ -1179,8 +1179,8 @@ async def test_config_schedule_logic(
"password": "test-password", "password": "test-password",
}, },
"retention": {"copies": None, "days": None}, "retention": {"copies": None, "days": None},
"last_attempted_strategy_backup": last_completed_strategy_backup, "last_attempted_automatic_backup": last_completed_automatic_backup,
"last_completed_strategy_backup": last_completed_strategy_backup, "last_completed_automatic_backup": last_completed_automatic_backup,
"schedule": {"state": "daily"}, "schedule": {"state": "daily"},
}, },
} }
@ -1210,11 +1210,11 @@ async def test_config_schedule_logic(
async_fire_time_changed(hass, fire_all=True) # flush out storage save async_fire_time_changed(hass, fire_all=True) # flush out storage save
await hass.async_block_till_done() await hass.async_block_till_done()
assert ( assert (
hass_storage[DOMAIN]["data"]["config"]["last_attempted_strategy_backup"] hass_storage[DOMAIN]["data"]["config"]["last_attempted_automatic_backup"]
== attempted_backup_time == attempted_backup_time
) )
assert ( assert (
hass_storage[DOMAIN]["data"]["config"]["last_completed_strategy_backup"] hass_storage[DOMAIN]["data"]["config"]["last_completed_automatic_backup"]
== completed_backup_time == completed_backup_time
) )
@ -1251,22 +1251,22 @@ async def test_config_schedule_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1290,22 +1290,22 @@ async def test_config_schedule_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1329,27 +1329,27 @@ async def test_config_schedule_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-09T04:45:00+01:00", date="2024-11-09T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-5": MagicMock( "backup-5": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1373,27 +1373,27 @@ async def test_config_schedule_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-09T04:45:00+01:00", date="2024-11-09T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-5": MagicMock( "backup-5": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1417,22 +1417,22 @@ async def test_config_schedule_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1456,22 +1456,22 @@ async def test_config_schedule_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1495,27 +1495,27 @@ async def test_config_schedule_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-09T04:45:00+01:00", date="2024-11-09T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-5": MagicMock( "backup-5": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1539,12 +1539,12 @@ async def test_config_schedule_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1595,8 +1595,8 @@ async def test_config_retention_copies_logic(
"password": "test-password", "password": "test-password",
}, },
"retention": {"copies": None, "days": None}, "retention": {"copies": None, "days": None},
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": last_backup_time, "last_completed_automatic_backup": last_backup_time,
"schedule": {"state": "daily"}, "schedule": {"state": "daily"},
}, },
} }
@ -1628,11 +1628,11 @@ async def test_config_retention_copies_logic(
async_fire_time_changed(hass, fire_all=True) # flush out storage save async_fire_time_changed(hass, fire_all=True) # flush out storage save
await hass.async_block_till_done() await hass.async_block_till_done()
assert ( assert (
hass_storage[DOMAIN]["data"]["config"]["last_attempted_strategy_backup"] hass_storage[DOMAIN]["data"]["config"]["last_attempted_automatic_backup"]
== backup_time == backup_time
) )
assert ( assert (
hass_storage[DOMAIN]["data"]["config"]["last_completed_strategy_backup"] hass_storage[DOMAIN]["data"]["config"]["last_completed_automatic_backup"]
== backup_time == backup_time
) )
@ -1641,7 +1641,7 @@ async def test_config_retention_copies_logic(
("backup_command", "backup_time"), ("backup_command", "backup_time"),
[ [
( (
{"type": "backup/generate_with_strategy_settings"}, {"type": "backup/generate_with_automatic_settings"},
"2024-11-11T12:00:00+01:00", "2024-11-11T12:00:00+01:00",
), ),
( (
@ -1672,22 +1672,22 @@ async def test_config_retention_copies_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1708,22 +1708,22 @@ async def test_config_retention_copies_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1744,27 +1744,27 @@ async def test_config_retention_copies_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-09T04:45:00+01:00", date="2024-11-09T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-5": MagicMock( "backup-5": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1785,27 +1785,27 @@ async def test_config_retention_copies_logic(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-09T04:45:00+01:00", date="2024-11-09T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-5": MagicMock( "backup-5": MagicMock(
date="2024-11-12T04:45:00+01:00", date="2024-11-12T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1852,8 +1852,8 @@ async def test_config_retention_copies_logic_manual_backup(
"password": "test-password", "password": "test-password",
}, },
"retention": {"copies": None, "days": None}, "retention": {"copies": None, "days": None},
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
"schedule": {"state": "daily"}, "schedule": {"state": "daily"},
}, },
} }
@ -1889,11 +1889,11 @@ async def test_config_retention_copies_logic_manual_backup(
async_fire_time_changed(hass, fire_all=True) # flush out storage save async_fire_time_changed(hass, fire_all=True) # flush out storage save
await hass.async_block_till_done() await hass.async_block_till_done()
assert ( assert (
hass_storage[DOMAIN]["data"]["config"]["last_attempted_strategy_backup"] hass_storage[DOMAIN]["data"]["config"]["last_attempted_automatic_backup"]
== backup_time == backup_time
) )
assert ( assert (
hass_storage[DOMAIN]["data"]["config"]["last_completed_strategy_backup"] hass_storage[DOMAIN]["data"]["config"]["last_completed_automatic_backup"]
== backup_time == backup_time
) )
@ -1922,17 +1922,17 @@ async def test_config_retention_copies_logic_manual_backup(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1955,17 +1955,17 @@ async def test_config_retention_copies_logic_manual_backup(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -1988,22 +1988,22 @@ async def test_config_retention_copies_logic_manual_backup(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-09T04:45:00+01:00", date="2024-11-09T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -2026,17 +2026,17 @@ async def test_config_retention_copies_logic_manual_backup(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -2059,17 +2059,17 @@ async def test_config_retention_copies_logic_manual_backup(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -2092,22 +2092,22 @@ async def test_config_retention_copies_logic_manual_backup(
{ {
"backup-1": MagicMock( "backup-1": MagicMock(
date="2024-11-09T04:45:00+01:00", date="2024-11-09T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-2": MagicMock( "backup-2": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-3": MagicMock( "backup-3": MagicMock(
date="2024-11-11T04:45:00+01:00", date="2024-11-11T04:45:00+01:00",
with_strategy_settings=True, with_automatic_settings=True,
spec=ManagerBackup, spec=ManagerBackup,
), ),
"backup-4": MagicMock( "backup-4": MagicMock(
date="2024-11-10T04:45:00+01:00", date="2024-11-10T04:45:00+01:00",
with_strategy_settings=False, with_automatic_settings=False,
spec=ManagerBackup, spec=ManagerBackup,
), ),
}, },
@ -2155,8 +2155,8 @@ async def test_config_retention_days_logic(
"password": "test-password", "password": "test-password",
}, },
"retention": {"copies": None, "days": None}, "retention": {"copies": None, "days": None},
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": last_backup_time, "last_completed_automatic_backup": last_backup_time,
"schedule": {"state": "never"}, "schedule": {"state": "never"},
}, },
} }

View File

@ -171,7 +171,7 @@ async def test_agents_list_backups(
"size": 34519040, "size": 34519040,
"agent_ids": ["cloud.cloud"], "agent_ids": ["cloud.cloud"],
"failed_agent_ids": [], "failed_agent_ids": [],
"with_strategy_settings": None, "with_automatic_settings": None,
} }
] ]
@ -195,8 +195,8 @@ async def test_agents_list_backups_fail_cloud(
assert response["result"] == { assert response["result"] == {
"agent_errors": {"cloud.cloud": "Failed to list backups"}, "agent_errors": {"cloud.cloud": "Failed to list backups"},
"backups": [], "backups": [],
"last_attempted_strategy_backup": None, "last_attempted_automatic_backup": None,
"last_completed_strategy_backup": None, "last_completed_automatic_backup": None,
} }
@ -218,7 +218,7 @@ async def test_agents_list_backups_fail_cloud(
"size": 34519040, "size": 34519040,
"agent_ids": ["cloud.cloud"], "agent_ids": ["cloud.cloud"],
"failed_agent_ids": [], "failed_agent_ids": [],
"with_strategy_settings": None, "with_automatic_settings": None,
}, },
), ),
( (

View File

@ -341,7 +341,7 @@ async def test_agent_info(
"name": "Test", "name": "Test",
"protected": False, "protected": False,
"size": 1048576, "size": 1048576,
"with_strategy_settings": None, "with_automatic_settings": None,
}, },
), ),
( (
@ -362,7 +362,7 @@ async def test_agent_info(
"name": "Test", "name": "Test",
"protected": False, "protected": False,
"size": 1048576, "size": 1048576,
"with_strategy_settings": None, "with_automatic_settings": None,
}, },
), ),
], ],

View File

@ -104,7 +104,7 @@ async def test_agents_list_backups(
"name": "Kitchen sink syncer", "name": "Kitchen sink syncer",
"protected": False, "protected": False,
"size": 1234, "size": 1234,
"with_strategy_settings": None, "with_automatic_settings": None,
} }
] ]
@ -183,7 +183,7 @@ async def test_agents_upload(
"name": "Test", "name": "Test",
"protected": False, "protected": False,
"size": 0.0, "size": 0.0,
"with_strategy_settings": False, "with_automatic_settings": False,
} }