2023-04-17 10:17:01 +00:00
|
|
|
from PyQt6 import QtCore
|
|
|
|
from PyQt6.QtWidgets import QDialogButtonBox
|
2021-11-17 09:14:11 +00:00
|
|
|
from vorta.store.models import BackupProfileModel
|
2020-10-30 04:15:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_profile_add(qapp, qtbot):
|
|
|
|
main = qapp.main_window
|
2023-04-17 10:17:01 +00:00
|
|
|
qtbot.mouseClick(main.profileAddButton, QtCore.Qt.MouseButton.LeftButton)
|
2020-11-19 07:44:07 +00:00
|
|
|
|
|
|
|
add_profile_window = main.window
|
2023-04-17 10:17:01 +00:00
|
|
|
# qtbot.addWidget(add_profile_window)
|
2020-11-20 00:46:09 +00:00
|
|
|
|
2020-10-30 04:15:38 +00:00
|
|
|
qtbot.keyClicks(add_profile_window.profileNameField, 'Test Profile')
|
2023-04-17 10:17:01 +00:00
|
|
|
qtbot.mouseClick(
|
|
|
|
add_profile_window.buttonBox.button(QDialogButtonBox.StandardButton.Save), QtCore.Qt.MouseButton.LeftButton
|
|
|
|
)
|
2020-11-19 07:44:07 +00:00
|
|
|
|
2020-10-30 04:15:38 +00:00
|
|
|
assert BackupProfileModel.get_or_none(name='Test Profile') is not None
|
2020-11-19 07:44:07 +00:00
|
|
|
assert main.profileSelector.currentText() == 'Test Profile'
|
|
|
|
|
2020-10-30 04:15:38 +00:00
|
|
|
|
|
|
|
def test_profile_edit(qapp, qtbot):
|
|
|
|
main = qapp.main_window
|
2023-04-17 10:17:01 +00:00
|
|
|
qtbot.mouseClick(main.profileRenameButton, QtCore.Qt.MouseButton.LeftButton)
|
2020-11-19 07:44:07 +00:00
|
|
|
|
|
|
|
edit_profile_window = main.window
|
2023-04-17 10:17:01 +00:00
|
|
|
# qtbot.addWidget(edit_profile_window)
|
2020-11-20 00:46:09 +00:00
|
|
|
|
2020-10-30 04:15:38 +00:00
|
|
|
edit_profile_window.profileNameField.setText("")
|
|
|
|
qtbot.keyClicks(edit_profile_window.profileNameField, 'Test Profile')
|
2023-04-17 10:17:01 +00:00
|
|
|
qtbot.mouseClick(
|
|
|
|
edit_profile_window.buttonBox.button(QDialogButtonBox.StandardButton.Save), QtCore.Qt.MouseButton.LeftButton
|
|
|
|
)
|
2020-11-19 07:44:07 +00:00
|
|
|
|
2020-10-30 04:15:38 +00:00
|
|
|
assert BackupProfileModel.get_or_none(name='Default') is None
|
|
|
|
assert BackupProfileModel.get_or_none(name='Test Profile') is not None
|
2020-11-19 07:44:07 +00:00
|
|
|
assert main.profileSelector.currentText() == 'Test Profile'
|