Test properties of the root interface

This commit is contained in:
Stein Magnus Jodal 2011-06-05 01:38:41 +02:00
parent fbf3d23fd8
commit b21f1caa2b
2 changed files with 25 additions and 1 deletions

View File

@ -155,7 +155,7 @@ class MprisObject(dbus.service.Object):
@dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
in_signature='ss', out_signature='v')
def Get(self, interface, prop):
logger.debug(u'%s.Get called', dbus.dbus.PROPERTIES_IFACE)
logger.debug(u'%s.Get called', dbus.PROPERTIES_IFACE)
getter, setter = self.properties[interface][prop]
return getter() if callable(getter) else getter

View File

@ -14,9 +14,33 @@ class RootInterfaceTest(unittest.TestCase):
def test_constructor_connects_to_dbus(self):
self.assert_(self.mpris_object._connect_to_dbus.called)
def test_can_raise_returns_false(self):
result = self.mpris_object.Get(mpris.ROOT_IFACE, 'CanRaise')
self.assertFalse(result)
def test_raise_does_nothing(self):
self.mpris_object.Raise()
def test_can_quit_returns_true(self):
result = self.mpris_object.Get(mpris.ROOT_IFACE, 'CanQuit')
self.assertTrue(result)
def test_quit_should_stop_all_actors(self):
self.mpris_object.Quit()
self.assert_(mpris.ActorRegistry.stop_all.called)
def test_has_track_list_returns_false(self):
result = self.mpris_object.Get(mpris.ROOT_IFACE, 'HasTrackList')
self.assertFalse(result)
def test_identify_is_mopidy(self):
result = self.mpris_object.Get(mpris.ROOT_IFACE, 'Identity')
self.assertEquals('Mopidy', result)
def test_supported_uri_schemes_is_empty(self):
result = self.mpris_object.Get(mpris.ROOT_IFACE, 'SupportedUriSchemes')
self.assertEquals(0, len(result))
def test_supported_mime_types_is_empty(self):
result = self.mpris_object.Get(mpris.ROOT_IFACE, 'SupportedMimeTypes')
self.assertEquals(0, len(result))