1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2024-12-23 08:17:08 +00:00
vorta/tests/test_notifications.py
Benjamin Pereto c5494f455c Add Background notifications for Linux (#114)
- Add DBus-based notifications for Linux and BSD desktops (@bpereto)
- Add module name to logging output (@bpereto)
2019-01-13 09:51:35 +08:00

20 lines
733 B
Python

import sys
import pytest
from PyQt5 import QtDBus
import vorta.borg
import vorta.models
import vorta.notifications
@pytest.mark.skipif(sys.platform != 'linux', reason="DBus notifications only on Linux")
def test_linux_background_notifications(app, mocker):
"""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