1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2024-12-22 15:57:34 +00:00
vorta/tests/test_scheduler.py
Manu 52233a9844
Fix flaky tests (#788)
* New DB for each test, hopefully takes care of race condition when using new DB.
* Centralize timeout setting
2021-02-17 10:14:58 +08:00

13 lines
480 B
Python

import pytest
import vorta.borg
import vorta.models
def test_scheduler_create_backup(qapp, qtbot, mocker, borg_json_output):
stdout, stderr = borg_json_output('create')
popen_result = mocker.MagicMock(stdout=stdout, stderr=stderr, returncode=0)
mocker.patch.object(vorta.borg.borg_thread, 'Popen', return_value=popen_result)
qapp.scheduler.create_backup(1)
qtbot.waitUntil(lambda: vorta.models.EventLogModel.select().count() == 2, **pytest._wait_defaults)