1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2024-12-25 01:07:24 +00:00
vorta/tests/test_archives.py

33 lines
1.2 KiB
Python
Raw Normal View History

from vorta.models import BackupProfileModel, ArchiveModel
2018-11-06 06:47:04 +00:00
import vorta.borg
def test_prune_intervals(app, qtbot):
prune_intervals = ['hour', 'day', 'week', 'month', 'year']
main = app.main_window
tab = main.archiveTab
2018-11-06 06:47:04 +00:00
profile = BackupProfileModel.get(id=1)
for i in prune_intervals:
getattr(tab, f'prune_{i}').setValue(9)
tab.save_prune_setting(None)
profile = profile.refresh()
assert getattr(profile, f'prune_{i}') == 9
def test_repo_list(app_with_repo, qtbot, mocker, borg_json_output):
main = app_with_repo.main_window
tab = main.archiveTab
2018-11-06 06:47:04 +00:00
main.tabWidget.setCurrentIndex(3)
tab.list_action()
assert not tab.checkButton.isEnabled()
stdout, stderr = borg_json_output('list')
popen_result = mocker.MagicMock(stdout=stdout, stderr=stderr, returncode=0)
2018-11-06 06:47:04 +00:00
mocker.patch.object(vorta.borg.borg_thread, 'Popen', return_value=popen_result)
qtbot.waitUntil(lambda: main.createProgressText.text() == 'Refreshing snapshots done.', timeout=3000)
assert ArchiveModel.select().count() == 6
2018-11-06 06:47:04 +00:00
assert main.createProgressText.text() == 'Refreshing snapshots done.'
assert tab.checkButton.isEnabled()