mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 17:26:46 +00:00
fix(backups): finish the autobackup job
This commit is contained in:
parent
742bb239e7
commit
bf33fff20d
|
@ -100,6 +100,8 @@ def do_autobackup() -> None:
|
||||||
progress = progress + progress_per_service
|
progress = progress + progress_per_service
|
||||||
Jobs.update(job, JobStatus.RUNNING, progress=progress)
|
Jobs.update(job, JobStatus.RUNNING, progress=progress)
|
||||||
|
|
||||||
|
Jobs.update(job, JobStatus.FINISHED)
|
||||||
|
|
||||||
|
|
||||||
@huey.periodic_task(validate_datetime=validate_datetime)
|
@huey.periodic_task(validate_datetime=validate_datetime)
|
||||||
def automatic_backup() -> None:
|
def automatic_backup() -> None:
|
||||||
|
|
|
@ -17,8 +17,9 @@ from selfprivacy_api.backup.tasks import (
|
||||||
automatic_backup,
|
automatic_backup,
|
||||||
do_autobackup,
|
do_autobackup,
|
||||||
)
|
)
|
||||||
|
from selfprivacy_api.backup.jobs import autobackup_job_type
|
||||||
|
|
||||||
from tests.test_backup import backups
|
from tests.test_backup import backups, assert_job_finished
|
||||||
from tests.test_graphql.test_services import only_dummy_service
|
from tests.test_graphql.test_services import only_dummy_service
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ def test_autobackup_taskbody(backups, only_dummy_service):
|
||||||
backup_period = 13 # minutes
|
backup_period = 13 # minutes
|
||||||
|
|
||||||
assert Backups.get_all_snapshots() == []
|
assert Backups.get_all_snapshots() == []
|
||||||
|
assert_job_finished(autobackup_job_type(), count=0)
|
||||||
|
|
||||||
Backups.set_autobackup_period_minutes(backup_period)
|
Backups.set_autobackup_period_minutes(backup_period)
|
||||||
assert Backups.is_time_to_backup_service(dummy_service, now)
|
assert Backups.is_time_to_backup_service(dummy_service, now)
|
||||||
|
@ -88,6 +90,8 @@ def test_autobackup_taskbody(backups, only_dummy_service):
|
||||||
assert snapshots[0].service_name == dummy_service.get_id()
|
assert snapshots[0].service_name == dummy_service.get_id()
|
||||||
assert snapshots[0].reason == BackupReason.AUTO
|
assert snapshots[0].reason == BackupReason.AUTO
|
||||||
|
|
||||||
|
assert_job_finished(autobackup_job_type(), count=1)
|
||||||
|
|
||||||
|
|
||||||
def test_autobackup_timer_periods(backups, dummy_service):
|
def test_autobackup_timer_periods(backups, dummy_service):
|
||||||
now = datetime.now(timezone.utc)
|
now = datetime.now(timezone.utc)
|
||||||
|
|
Loading…
Reference in a new issue