2021-02-17 02:14:58 +00:00
|
|
|
import pytest
|
2018-11-30 00:40:18 +00:00
|
|
|
import vorta.borg
|
2021-11-17 09:14:11 +00:00
|
|
|
from vorta.store.models import EventLogModel
|
2018-11-30 00:40:18 +00:00
|
|
|
|
|
|
|
|
2020-03-03 05:19:36 +00:00
|
|
|
def test_scheduler_create_backup(qapp, qtbot, mocker, borg_json_output):
|
2021-11-12 07:05:31 +00:00
|
|
|
events_before = EventLogModel.select().count()
|
2018-11-30 00:40:18 +00:00
|
|
|
stdout, stderr = borg_json_output('create')
|
|
|
|
popen_result = mocker.MagicMock(stdout=stdout, stderr=stderr, returncode=0)
|
2021-10-04 11:31:41 +00:00
|
|
|
mocker.patch.object(vorta.borg.borg_job, 'Popen', return_value=popen_result)
|
2018-11-30 00:40:18 +00:00
|
|
|
|
2021-11-12 07:05:31 +00:00
|
|
|
with qtbot.waitSignal(qapp.backup_finished_event, **pytest._wait_defaults):
|
|
|
|
qapp.scheduler.create_backup(1)
|
|
|
|
|
|
|
|
assert EventLogModel.select().where(EventLogModel.returncode == 0).count() == events_before + 1
|