This is a test of presence. To test this service we will start up a mock dbus library: >>> from sugar.testing import mockdbus >>> import dbus >>> pres_service = mockdbus.MockService( ... 'org.laptop.Presence', '/org/laptop/Presence', name='pres') >>> pres_service.install() >>> pres_interface = dbus.Interface(pres_service, 'org.laptop.Presence') Then we import the library (second, to make sure it connects to our mocked system, though the lazy instantiation in get_instance() should handle it): >>> from sugar.presence import PresenceService >>> ps = PresenceService.get_instance() >>> pres_interface.make_response('getServices', []) >>> ps.get_services() Called pres.org.laptop.Presence:getServices() [] >>> pres_interface.make_response('getBuddies', []) >>> ps.get_buddies() Called pres.org.laptop.Presence:getBuddies() []