Browse Source

dbus:// url() lookup bugfix

pull/175/head
Chris Caron 5 years ago
parent
commit
71b59f9bbb
  1. 6
      apprise/plugins/NotifyDBus.py
  2. 15
      test/test_glib_plugin.py

6
apprise/plugins/NotifyDBus.py

@ -159,10 +159,6 @@ class NotifyDBus(NotifyBase):
# content to display
body_max_line_count = 10
# A title can not be used for SMS Messages. Setting this to zero will
# cause any title (if defined) to get placed into the message body.
title_maxlen = 0
# This entry is a bit hacky, but it allows us to unit-test this library
# in an environment that simply doesn't have the gnome packages
# available to us. It also allows us to handle situations where the
@ -364,7 +360,7 @@ class NotifyDBus(NotifyBase):
args['y'] = str(self.y_axis)
return '{schema}://_/?{args}'.format(
schema=self.protocol,
schema=self.schema,
args=NotifyDBus.urlencode(args),
)

15
test/test_glib_plugin.py

@ -23,6 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import re
import six
import pytest
import mock
@ -137,12 +138,20 @@ def test_dbus_plugin(mock_mainloop, mock_byte, mock_bytearray,
# Create our instance (identify all supported types)
obj = apprise.Apprise.instantiate('dbus://', suppress_exceptions=False)
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
assert isinstance(obj.url(), six.string_types) is True
assert obj.url().startswith('dbus://_/')
obj = apprise.Apprise.instantiate('kde://', suppress_exceptions=False)
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
assert isinstance(obj.url(), six.string_types) is True
assert obj.url().startswith('kde://_/')
obj = apprise.Apprise.instantiate('qt://', suppress_exceptions=False)
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
assert isinstance(obj.url(), six.string_types) is True
assert obj.url().startswith('qt://_/')
obj = apprise.Apprise.instantiate('glib://', suppress_exceptions=False)
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
assert isinstance(obj.url(), six.string_types) is True
assert obj.url().startswith('glib://_/')
obj.duration = 0
# Check that it found our mocked environments
@ -176,6 +185,9 @@ def test_dbus_plugin(mock_mainloop, mock_byte, mock_bytearray,
'dbus://_/?image=True', suppress_exceptions=False)
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
assert isinstance(obj.url(), six.string_types) is True
assert obj.url().startswith('dbus://_/')
assert re.search('image=yes', obj.url())
assert obj.notify(
title='title', body='body',
notify_type=apprise.NotifyType.INFO) is True
@ -184,6 +196,9 @@ def test_dbus_plugin(mock_mainloop, mock_byte, mock_bytearray,
'dbus://_/?image=False', suppress_exceptions=False)
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
assert isinstance(obj.url(), six.string_types) is True
assert obj.url().startswith('dbus://_/')
assert re.search('image=no', obj.url())
assert obj.notify(
title='title', body='body',
notify_type=apprise.NotifyType.INFO) is True

Loading…
Cancel
Save