mirror of
https://github.com/borgbase/vorta
synced 2024-12-23 00:07:58 +00:00
Add profile add/edit test cases (#695)
This commit is contained in:
parent
d5f3d102f2
commit
47df3eccc9
1 changed files with 29 additions and 0 deletions
29
tests/test_profile.py
Normal file
29
tests/test_profile.py
Normal 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
|
Loading…
Reference in a new issue