sugar-toolkit-gtk3/sugar/presence/test_presence.txt

27 lines
900 B
Plaintext
Raw Normal View History

This is a test of presence.
To test this service we will start up a mock dbus library:
2006-10-03 19:50:21 +02:00
>>> from sugar.testing import mockdbus
>>> import dbus
2006-10-03 19:50:21 +02:00
>>> 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()
[]