async def test_ignored_backups(updater: HaUpdater, time: FakeTime, server: SimulationServer, backup: Backup, supervisor: SimulatedSupervisor, coord: Coordinator, config: Config): config.override(Setting.IGNORE_OTHER_BACKUPS, True) time.advance(hours=1) await supervisor.createBackup({'name': "test_backup"}, date=time.now()) await coord.sync() await updater.update() state = supervisor.getAttributes("sensor.backup_state") assert state["backups_in_google_drive"] == 1 assert state["backups_in_home_assistant"] == 1 assert len(state["backups"]) == 1 assert state['last_backup'] == backup.date().isoformat()
async def test_ignored_snapshots(updater: HaUpdater, time: Time, server: SimulationServer, snapshot, supervisor: SimulatedSupervisor, coord: Coordinator, config: Config): config.override(Setting.IGNORE_OTHER_SNAPSHOTS, True) await supervisor.createSnapshot({'name': "test_snapshot"}, date=time.now()) await coord.sync() await updater.update() state = supervisor.getAttributes("sensor.snapshot_backup") assert state["snapshots_in_google_drive"] == 1 assert state["snapshots_in_home_assistant"] == 1 assert len(state["snapshots"]) == 2
def verifyEntity(backend: SimulatedSupervisor, name, state, attributes): assert backend.getEntity(name) == state assert backend.getAttributes(name) == attributes