Add profile add/edit test cases (#695)

This commit is contained in:
Samuel 2020-10-29 23:15:38 -05:00 committed by GitHub
parent d5f3d102f2
commit 47df3eccc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 0 deletions

29
tests/test_profile.py Normal file
View File

@ -0,0 +1,29 @@
from PyQt5 import QtCore
from PyQt5.QtWidgets import QDialogButtonBox
from vorta.views.profile_add_edit_dialog import AddProfileWindow, EditProfileWindow
from vorta.models import BackupProfileModel
def test_profile_add(qapp, qtbot):
main = qapp.main_window
add_profile_window = AddProfileWindow(main)
qtbot.addWidget(add_profile_window)
# Add a new profile
qtbot.keyClicks(add_profile_window.profileNameField, 'Test Profile')
qtbot.mouseClick(add_profile_window.buttonBox.button(QDialogButtonBox.Save), QtCore.Qt.LeftButton)
assert BackupProfileModel.get_or_none(name='Test Profile') is not None
def test_profile_edit(qapp, qtbot):
main = qapp.main_window
edit_profile_window = EditProfileWindow(main, rename_existing_id=main.profileSelector.currentData())
qtbot.addWidget(edit_profile_window)
# Edit profile name
edit_profile_window.profileNameField.setText("")
qtbot.keyClicks(edit_profile_window.profileNameField, 'Test Profile')
qtbot.mouseClick(edit_profile_window.buttonBox.button(QDialogButtonBox.Save), QtCore.Qt.LeftButton)
assert BackupProfileModel.get_or_none(name='Default') is None
assert BackupProfileModel.get_or_none(name='Test Profile') is not None