1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2024-12-22 15:57:34 +00:00
vorta/tests/test_borg.py
Bastien 54d8bbe6b1
Implement multiple queues. By @bastiencyr (#1045)
Scheduler now has the ability to run jobs on multiple repositories concurrently and run multiple jobs on one repo (by queuing them).

For each repository, there is one queue. I have represented a queue by a 'site'. Between sites (ie repository), tasks run concurrently. On one site, tasks run one by one. The user also run tasks by adding them to the queue but he can't run multiple backups because start backup button is disabled when a job is running.
2021-10-04 15:31:41 +04:00

19 lines
691 B
Python

import pytest
import vorta.borg
import vorta.models
from vorta.borg.prune import BorgPruneJob
def test_borg_prune(qapp, qtbot, mocker, borg_json_output):
stdout, stderr = borg_json_output('prune')
popen_result = mocker.MagicMock(stdout=stdout, stderr=stderr, returncode=0)
mocker.patch.object(vorta.borg.borg_job, 'Popen', return_value=popen_result)
params = BorgPruneJob.prepare(vorta.models.BackupProfileModel.select().first())
thread = BorgPruneJob(params['cmd'], params, qapp)
with qtbot.waitSignal(thread.result, **pytest._wait_defaults) as blocker:
blocker.connect(thread.updated)
thread.run()
assert blocker.args[0]['returncode'] == 0