2019-01-13 01:51:35 +00:00
|
|
|
import sys
|
2023-05-01 08:28:11 +00:00
|
|
|
|
2019-01-13 01:51:35 +00:00
|
|
|
import pytest
|
|
|
|
import vorta.borg
|
|
|
|
import vorta.notifications
|
2023-04-17 10:17:01 +00:00
|
|
|
from PyQt6 import QtDBus
|
2019-01-13 01:51:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skipif(sys.platform != 'linux', reason="DBus notifications only on Linux")
|
2020-03-03 05:19:36 +00:00
|
|
|
def test_linux_background_notifications(qapp, mocker):
|
2019-01-13 01:51:35 +00:00
|
|
|
"""We can't see notifications, but we watch for exceptions and errors."""
|
|
|
|
|
|
|
|
notifier = vorta.notifications.VortaNotifications.pick()
|
|
|
|
assert isinstance(notifier, vorta.notifications.DBusNotifications)
|
|
|
|
notifier.deliver('Vorta Test', 'test notification', level='error')
|
|
|
|
|
|
|
|
mocker.spy(QtDBus.QDBusInterface, 'call')
|
|
|
|
notifier.deliver('Vorta Test', 'test notification', level='info') # fails if called.
|
|
|
|
assert QtDBus.QDBusInterface.call.call_count == 0
|