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

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


---
 tests/twisted/muc/test-ensure.py |   34 +++++-----------------------------
 1 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/tests/twisted/muc/test-ensure.py b/tests/twisted/muc/test-ensure.py
index e04b362..ae8c42e 100644
--- a/tests/twisted/muc/test-ensure.py
+++ b/tests/twisted/muc/test-ensure.py
@@ -7,7 +7,7 @@ import dbus
 
 from twisted.words.xish import domish
 
-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, EventPattern
 
 def test(q, bus, conn, stream):
@@ -70,22 +70,10 @@ def test_create_ensure(q, conn, bus, stream, room_jid, room_handle):
     assert len(remote_pending) == 1, mc.args
 
     # Send presence for other member of room.
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = '%s/bob' % room_jid
-    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', room_jid, 'bob'))
 
     # Send presence for own membership of room.
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = '%s/test' % room_jid
-    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', room_jid, 'test'))
 
     mc = q.expect('dbus-signal', signal='MembersChanged')
     msg, added, removed, local_pending, remote_pending, actor, reason = mc.args
@@ -144,22 +132,10 @@ def test_ensure_ensure(q, conn, bus, stream, room_jid, room_handle):
     assert len(remote_pending) == 1, mc.args
 
     # Send presence for other member of room.
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = '%s/bob' % room_jid
-    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', room_jid, 'bob'))
 
     # Send presence for own membership of room.
-    presence = domish.Element((None, 'presence'))
-    presence['from'] = '%s/test' % room_jid
-    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', room_jid, 'test'))
 
     mc = q.expect('dbus-signal', signal='MembersChanged')
     msg, added, removed, local_pending, remote_pending, actor, reason = mc.args
-- 
1.5.6.5




More information about the telepathy-commits mailing list