mirror of https://github.com/caronc/apprise
dbus:// url() lookup bugfix
parent
031f6776cc
commit
71b59f9bbb
|
@ -159,10 +159,6 @@ class NotifyDBus(NotifyBase):
|
||||||
# content to display
|
# content to display
|
||||||
body_max_line_count = 10
|
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
|
# 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
|
# in an environment that simply doesn't have the gnome packages
|
||||||
# available to us. It also allows us to handle situations where the
|
# 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)
|
args['y'] = str(self.y_axis)
|
||||||
|
|
||||||
return '{schema}://_/?{args}'.format(
|
return '{schema}://_/?{args}'.format(
|
||||||
schema=self.protocol,
|
schema=self.schema,
|
||||||
args=NotifyDBus.urlencode(args),
|
args=NotifyDBus.urlencode(args),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
|
import re
|
||||||
import six
|
import six
|
||||||
import pytest
|
import pytest
|
||||||
import mock
|
import mock
|
||||||
|
@ -137,12 +138,20 @@ def test_dbus_plugin(mock_mainloop, mock_byte, mock_bytearray,
|
||||||
# Create our instance (identify all supported types)
|
# Create our instance (identify all supported types)
|
||||||
obj = apprise.Apprise.instantiate('dbus://', suppress_exceptions=False)
|
obj = apprise.Apprise.instantiate('dbus://', suppress_exceptions=False)
|
||||||
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
|
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)
|
obj = apprise.Apprise.instantiate('kde://', suppress_exceptions=False)
|
||||||
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
|
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)
|
obj = apprise.Apprise.instantiate('qt://', suppress_exceptions=False)
|
||||||
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
|
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)
|
obj = apprise.Apprise.instantiate('glib://', suppress_exceptions=False)
|
||||||
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
|
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
|
obj.duration = 0
|
||||||
|
|
||||||
# Check that it found our mocked environments
|
# 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)
|
'dbus://_/?image=True', suppress_exceptions=False)
|
||||||
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
|
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
|
||||||
assert isinstance(obj.url(), six.string_types) 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(
|
assert obj.notify(
|
||||||
title='title', body='body',
|
title='title', body='body',
|
||||||
notify_type=apprise.NotifyType.INFO) is True
|
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)
|
'dbus://_/?image=False', suppress_exceptions=False)
|
||||||
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
|
assert isinstance(obj, apprise.plugins.NotifyDBus) is True
|
||||||
assert isinstance(obj.url(), six.string_types) 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(
|
assert obj.notify(
|
||||||
title='title', body='body',
|
title='title', body='body',
|
||||||
notify_type=apprise.NotifyType.INFO) is True
|
notify_type=apprise.NotifyType.INFO) is True
|
||||||
|
|
Loading…
Reference in New Issue