I added tests for the presence client interface. But the presence
client interface, I realize, is really boring and not worth testing much. More interesting, I guess, is the mockdbus module. This will need some more extension to be used by a server (I think), like the presence server.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
This is a test of presence.
|
||||
|
||||
To test this service we will start up a mock dbus library:
|
||||
|
||||
>>> from sugar import mock_dbus
|
||||
>>> import dbus
|
||||
>>> pres_service = mock_dbus.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()
|
||||
[]
|
||||
|
||||
Reference in New Issue
Block a user