1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2024-12-23 08:17:08 +00:00
vorta/tests/unit/test_profile.py
jetchirag b015368fee
Integration Tests for Borg (#1716)
Move existing tests into subfolder `tests/unit`. Write integration tests that actually run the installed borg executable. Those tests can be found in `tests/integration`.  Those pytest fixtures that are the same for both kinds of tests remain in `tests/conftest.py`. The others can be found in `tests/integration/conftest.py` or `tests/unit/conftest.py`. This adds nox to the project and configures it to run the tests with different borg versions. This also updates the ci workflow to run the integration tests using nox.

* noxfile.py : Run pytest with a matrix of borg versions OR a specific borg version

* Makefile : Run using nox. Add phonies `test-unit` and `test-integration`.

* tests/conftest.py : Move some fixtures/functions to `tests/unit/conftest.py`.

* tests/test_*.py --> tests/unit/ : Move unittests and assets into subfolder

* tests/integration/ : Write integration tests.

* requirements.d/dev.txt: Add `nox` and `pkgconfig`. The latter is needed for installing new borg versions.

* .github/actions/setup/action.yml : Update to install pre-commit and nox when needed. The action now no longer installs Vorta.

* .github/actions/install-dependencies/action.yml : Install system deps of borg with this new composite action.

* .github/workflows/test.yml : Rename `test` ci to `test-unit` and update it for the new test setup.
                                              Implement `test-integration` ci.

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
2023-08-05 13:49:45 +00:00

37 lines
1.4 KiB
Python

from PyQt6 import QtCore
from PyQt6.QtWidgets import QDialogButtonBox
from vorta.store.models import BackupProfileModel
def test_profile_add(qapp, qtbot):
main = qapp.main_window
qtbot.mouseClick(main.profileAddButton, QtCore.Qt.MouseButton.LeftButton)
add_profile_window = main.window
# qtbot.addWidget(add_profile_window)
qtbot.keyClicks(add_profile_window.profileNameField, 'Test Profile')
qtbot.mouseClick(
add_profile_window.buttonBox.button(QDialogButtonBox.StandardButton.Save), QtCore.Qt.MouseButton.LeftButton
)
assert BackupProfileModel.get_or_none(name='Test Profile') is not None
assert main.profileSelector.currentText() == 'Test Profile'
def test_profile_edit(qapp, qtbot):
main = qapp.main_window
qtbot.mouseClick(main.profileRenameButton, QtCore.Qt.MouseButton.LeftButton)
edit_profile_window = main.window
# qtbot.addWidget(edit_profile_window)
edit_profile_window.profileNameField.setText("")
qtbot.keyClicks(edit_profile_window.profileNameField, 'Test Profile')
qtbot.mouseClick(
edit_profile_window.buttonBox.button(QDialogButtonBox.StandardButton.Save), QtCore.Qt.MouseButton.LeftButton
)
assert BackupProfileModel.get_or_none(name='Default') is None
assert BackupProfileModel.get_or_none(name='Test Profile') is not None
assert main.profileSelector.currentText() == 'Test Profile'