[Telepathy-commits] [telepathy-gabble/master] Add a trivial test for RoomList channels (it doesn't actually list any rooms, just exercises the properties)
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Aug 19 10:53:13 PDT 2008
20080606164143-53eee-a6e59f3f3610477c2f31f657442103bb0b0416da.gz
---
tests/twisted/Makefile.am | 1 +
tests/twisted/muc/roomlist.py | 69 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 0 deletions(-)
create mode 100644 tests/twisted/muc/roomlist.py
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index a516072..3b126a0 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -1,4 +1,5 @@
TWISTED_TESTS = \
+ muc/roomlist.py \
muc/test-muc-invitation.py \
muc/test-muc-ownership.py \
muc/test-muc-properties.py \
diff --git a/tests/twisted/muc/roomlist.py b/tests/twisted/muc/roomlist.py
new file mode 100644
index 0000000..6e4db41
--- /dev/null
+++ b/tests/twisted/muc/roomlist.py
@@ -0,0 +1,69 @@
+
+"""
+Test MUC support.
+"""
+
+import dbus
+
+from twisted.words.xish import domish
+
+from gabbletest import go, make_result_iq, exec_test, sync_stream
+from servicetest import call_async, lazy, match, EventPattern
+
+def test(q, bus, conn, stream):
+ conn.Connect()
+
+ q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
+
+ event = q.expect('stream-iq', to='localhost',
+ query_ns='http://jabber.org/protocol/disco#items')
+ result = make_result_iq(stream, event.stanza)
+ item = result.firstChildElement().addElement('item')
+ item['jid'] = 'conf.localhost'
+ stream.send(result)
+
+ event = q.expect('stream-iq', to='conf.localhost',
+ query_ns='http://jabber.org/protocol/disco#info')
+ result = make_result_iq(stream, event.stanza)
+ feature = result.firstChildElement().addElement('feature')
+ feature['var'] = 'http://jabber.org/protocol/muc'
+ identity = result.firstChildElement().addElement('identity')
+ identity['category'] = 'conference'
+ identity['name'] = 'conference service'
+ identity['type'] = 'text'
+ stream.send(result)
+
+ # Make sure the stream has been processed
+ sync_stream(q, stream)
+
+ call_async(q, conn, 'RequestChannel',
+ 'org.freedesktop.Telepathy.Channel.Type.RoomList', 0, 0, True)
+
+ event = q.expect('dbus-return', method='RequestChannel')
+
+ bus = dbus.SessionBus()
+ text_chan = bus.get_object(conn.bus_name, event.value[0])
+
+ # Exercise basic Channel Properties from spec 0.17.7
+ channel_props = text_chan.GetAll(
+ 'org.freedesktop.Telepathy.Channel',
+ dbus_interface='org.freedesktop.DBus.Properties')
+ assert channel_props.get('TargetHandle') == 0,\
+ channel_props.get('TargetHandle')
+ assert channel_props.get('TargetHandleType') == 0,\
+ channel_props.get('TargetHandleType')
+ assert channel_props.get('ChannelType') == \
+ 'org.freedesktop.Telepathy.Channel.Type.RoomList',\
+ channel_props.get('ChannelType')
+ assert 'Interfaces' in channel_props
+ assert channel_props['Interfaces'] == []
+
+ # FIXME: actually list the rooms!
+
+ conn.Disconnect()
+
+ q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
+
+if __name__ == '__main__':
+ exec_test(test)
+
--
1.5.6.3
More information about the Telepathy-commits
mailing list