dbus:// url() lookup bugfix

pull/175/head
Chris Caron 2019-10-27 16:54:57 -04:00
parent 031f6776cc
commit 71b59f9bbb
2 changed files with 16 additions and 5 deletions

View File

@ -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),
)

View File

@ -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