mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-28 06:51:28 +00:00
test(backups): test the trimming task
This commit is contained in:
parent
d549e29304
commit
a6dda2d71a
|
@ -43,7 +43,7 @@ def start_backup(
|
||||||
|
|
||||||
|
|
||||||
@huey.task()
|
@huey.task()
|
||||||
def prune_autobackup_snapshots(quotas: AutobackupQuotas, job: Job) -> bool:
|
def prune_autobackup_snapshots(job: Job) -> bool:
|
||||||
"""
|
"""
|
||||||
Remove all autobackup snapshots that do not fit into quotas set
|
Remove all autobackup snapshots that do not fit into quotas set
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -44,6 +44,7 @@ from selfprivacy_api.backup.tasks import (
|
||||||
start_backup,
|
start_backup,
|
||||||
restore_snapshot,
|
restore_snapshot,
|
||||||
reload_snapshot_cache,
|
reload_snapshot_cache,
|
||||||
|
prune_autobackup_snapshots
|
||||||
)
|
)
|
||||||
from selfprivacy_api.backup.storage import Storage
|
from selfprivacy_api.backup.storage import Storage
|
||||||
from selfprivacy_api.backup.jobs import get_backup_job
|
from selfprivacy_api.backup.jobs import get_backup_job
|
||||||
|
@ -651,7 +652,9 @@ def test_too_many_auto(backups, dummy_service):
|
||||||
# Retroactivity
|
# Retroactivity
|
||||||
quota.last = 1
|
quota.last = 1
|
||||||
Backups.set_autobackup_quotas(quota)
|
Backups.set_autobackup_quotas(quota)
|
||||||
Backups.prune_all_autosnaps()
|
job = Jobs.add("trimming", "test.autobackup_trimming", "trimming the snaps!")
|
||||||
|
handle=prune_autobackup_snapshots(job)
|
||||||
|
handle(blocking=True)
|
||||||
snaps = Backups.get_snapshots(dummy_service)
|
snaps = Backups.get_snapshots(dummy_service)
|
||||||
assert len(snaps) == 1
|
assert len(snaps) == 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue