Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/presence
diff options
context:
space:
mode:
authorIan Bicking <ianb@lothlorien.localdomain>2006-10-03 17:25:05 (GMT)
committer Ian Bicking <ianb@lothlorien.localdomain>2006-10-03 17:25:05 (GMT)
commitb010c0cd42590efde2924ac6d2f99b142b552180 (patch)
tree1d49ba4ae67c4c2d9de807cfef30921348d191ed /sugar/presence
parent48951dc1cb8efcba60463b31226d0aaf05fc1afd (diff)
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.
Diffstat (limited to 'sugar/presence')
-rw-r--r--sugar/presence/test_presence.txt26
1 files changed, 26 insertions, 0 deletions
diff --git a/sugar/presence/test_presence.txt b/sugar/presence/test_presence.txt
new file mode 100644
index 0000000..e62886a
--- /dev/null
+++ b/sugar/presence/test_presence.txt
@@ -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()
+ []
+