[telepathy-gabble/telepathy-gabble-0.8] presence.py: use make_presence()

Dafydd Harries dafydd.harries at collabora.co.uk
Wed Sep 23 08:27:22 PDT 2009


---
 tests/twisted/presence/presence.py |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/tests/twisted/presence/presence.py b/tests/twisted/presence/presence.py
index 901c88c..2903544 100644
--- a/tests/twisted/presence/presence.py
+++ b/tests/twisted/presence/presence.py
@@ -6,7 +6,7 @@ FIXME: test C.I.Presence too
 
 from twisted.words.xish import domish
 
-from gabbletest import exec_test
+from gabbletest import exec_test, make_presence
 from servicetest import EventPattern
 import ns
 import constants as cs
@@ -28,27 +28,15 @@ def test(q, bus, conn, stream):
     item['subscription'] = 'both'
 
     stream.send(event.stanza)
+    stream.send(make_presence('amy at foo.com', show='away', status='At the pub'))
 
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = 'amy at foo.com'
-    show = presence.addElement((None, 'show'))
-    show.addContent('away')
-    status = presence.addElement((None, 'status'))
-    status.addContent('At the pub')
-    stream.send(presence)
-
-    event = q.expect('dbus-signal', signal='PresencesChanged',
+    q.expect('dbus-signal', signal='PresencesChanged',
         args=[{amy_handle: (3, 'away', 'At the pub')}])
 
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = 'amy at foo.com'
-    show = presence.addElement((None, 'show'))
-    show.addContent('chat')
-    status = presence.addElement((None, 'status'))
-    status.addContent('I may have been drinking')
-    stream.send(presence)
+    stream.send(make_presence(
+        'amy at foo.com', show='chat', status='I may have been drinking'))
 
-    event = q.expect('dbus-signal', signal='PresencesChanged',
+    q.expect('dbus-signal', signal='PresencesChanged',
         args=[{amy_handle: (2, 'chat', 'I may have been drinking')}])
 
 if __name__ == '__main__':
-- 
1.5.6.5




More information about the telepathy-commits mailing list