Skip to content

Commit

Permalink
test_enable_background_question
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtedde committed Sep 28, 2023
1 parent 9817290 commit a6010d2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/unit/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
import vorta.store.models
from PyQt6 import QtCore
from PyQt6.QtGui import QCloseEvent
from PyQt6.QtWidgets import QCheckBox, QFormLayout
from vorta.store.models import SettingsModel

Expand Down Expand Up @@ -53,6 +54,23 @@ def test_autostart_linux(qapp, qtbot):
assert not os.path.exists(autostart_path)


def test_enable_background_question(qapp, monkeypatch, mocker):
main = qapp.main_window
close_event = Mock(value=QCloseEvent())

# disable system trey and enable setting to test
monkeypatch.setattr("vorta.views.main_window.is_system_tray_available", lambda: False)
mocker.patch.object(vorta.store.models.SettingsModel, "get", return_value=Mock(value=True))

# users should be prompted whether to run Vorta in background
mock_msgbox = mocker.patch("vorta.views.main_window.QMessageBox", autospec=True)
main.closeEvent(close_event)

mock_msgbox.assert_called_once()
mock_msgbox().setText.assert_called_with("Should Vorta continue to run in the background?")
close_event.accept.assert_called_once()


def test_enable_fixed_units(qapp, qtbot, mocker):
"""Tests the 'enable fixed units' setting to ensure the archive tab sizes are displayed correctly."""
tab = qapp.main_window.archiveTab
Expand Down

0 comments on commit a6010d2

Please sign in to comment.