[Telepathy-commits] [telepathy-gabble/master] accept-muc-stream-tube: use make_muc_presence
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Thu Mar 12 03:47:35 PDT 2009
---
tests/twisted/tubes/accept-muc-stream-tube.py | 25 ++++---------------------
1 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/tests/twisted/tubes/accept-muc-stream-tube.py b/tests/twisted/tubes/accept-muc-stream-tube.py
index 2a86a65..cb2da6c 100644
--- a/tests/twisted/tubes/accept-muc-stream-tube.py
+++ b/tests/twisted/tubes/accept-muc-stream-tube.py
@@ -3,7 +3,7 @@
import dbus
from servicetest import call_async, EventPattern, EventProtocolClientFactory, unwrap
-from gabbletest import make_result_iq, acknowledge_iq
+from gabbletest import make_result_iq, acknowledge_iq, make_muc_presence
import constants as cs
import ns
import tubetestutil as t
@@ -53,22 +53,10 @@ def test(q, bus, conn, stream, bytestream_cls):
EventPattern('stream-presence', to='chat at conf.localhost/test'))
# Send presence for 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 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'))
q.expect('dbus-signal', signal='MembersChanged',
args=[u'', [2, 3], [], [], [], 0, 0])
@@ -81,12 +69,7 @@ def test(q, bus, conn, stream, bytestream_cls):
# Bob offers a stream tube
stream_tube_id = 666
- 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'
+ presence = make_muc_presence('owner', 'moderator', 'chat at conf.localhost', 'bob')
tubes = presence.addElement((ns.TUBES, 'tubes'))
tube = tubes.addElement((None, 'tube'))
tube['type'] = 'stream'
--
1.5.6.5
More information about the telepathy-commits
mailing list