[Telepathy-commits] [telepathy-gabble/master] muc/test-muc-ownership.py: use make_muc_presence

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Thu Mar 12 04:23:43 PDT 2009


---
 tests/twisted/muc/test-muc-ownership.py |   46 +++++-------------------------
 1 files changed, 8 insertions(+), 38 deletions(-)

diff --git a/tests/twisted/muc/test-muc-ownership.py b/tests/twisted/muc/test-muc-ownership.py
index 4cc1a46..93d1f2e 100644
--- a/tests/twisted/muc/test-muc-ownership.py
+++ b/tests/twisted/muc/test-muc-ownership.py
@@ -11,7 +11,7 @@ import dbus
 
 from twisted.words.xish import domish, xpath
 
-from gabbletest import go, make_result_iq, exec_test
+from gabbletest import go, make_result_iq, exec_test, make_muc_presence
 from servicetest import call_async, lazy, match, tp_name_prefix, EventPattern
 
 def test(q, bus, conn, stream):
@@ -47,51 +47,21 @@ def test(q, bus, conn, stream):
     assert event.args == [0, 1]
 
     # Send presence for anonymous other member of room.
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = 'chat at conf.localhost/bob'
-    x = presence.addElement(('http://jabber.org/protocol/muc#user', 'x'))
-    item = x.addElement('item')
-    item['affiliation'] = 'owner'
-    item['role'] = 'moderator'
-    stream.send(presence)
+    stream.send(make_muc_presence('owner', 'moderator', 'chat at conf.localhost', 'bob'))
 
     # Send presence for anonymous other member of room (2)
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = 'chat at conf.localhost/brian'
-    x = presence.addElement(('http://jabber.org/protocol/muc#user', 'x'))
-    item = x.addElement('item')
-    item['affiliation'] = 'owner'
-    item['role'] = 'moderator'
-    stream.send(presence)
+    stream.send(make_muc_presence('owner', 'moderator', 'chat at conf.localhost', 'brian'))
 
     # Send presence for nonymous other member of room.
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = 'chat at conf.localhost/che'
-    x = presence.addElement(('http://jabber.org/protocol/muc#user', 'x'))
-    item = x.addElement('item')
-    item['affiliation'] = 'none'
-    item['role'] = 'participant'
-    item['jid'] = 'che at foo.com'
-    stream.send(presence)
+    stream.send(make_muc_presence('none', 'participant', 'chat at conf.localhost',
+        'che', 'che at foo.com'))
 
     # Send presence for nonymous other member of room (2)
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = 'chat at conf.localhost/chris'
-    x = presence.addElement(('http://jabber.org/protocol/muc#user', 'x'))
-    item = x.addElement('item')
-    item['affiliation'] = 'none'
-    item['role'] = 'participant'
-    item['jid'] = 'chris at foo.com'
-    stream.send(presence)
+    stream.send(make_muc_presence('none', 'participant', 'chat at conf.localhost',
+        'chris', 'chris at foo.com'))
 
     # Send presence for own membership of room.
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = 'chat at conf.localhost/test'
-    x = presence.addElement(('http://jabber.org/protocol/muc#user', 'x'))
-    item = x.addElement('item')
-    item['affiliation'] = 'none'
-    item['role'] = 'participant'
-    stream.send(presence)
+    stream.send(make_muc_presence('none', 'participant', 'chat at conf.localhost', 'test'))
 
     event = q.expect('dbus-signal', signal='GroupFlagsChanged')
     # Since we received MUC presence that contains an owner JID, the
-- 
1.5.6.5




More information about the telepathy-commits mailing list