[telepathy-gabble/telepathy-gabble-0.8] caps/compat-bundles.py: test that the voice-v1 and video-v1 bundles can be disco'd
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Sep 8 08:30:26 PDT 2009
---
tests/twisted/Makefile.am | 1 +
tests/twisted/caps/compat-bundles.py | 52 ++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 0 deletions(-)
create mode 100644 tests/twisted/caps/compat-bundles.py
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index f185c28..0ea0a8c 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -4,6 +4,7 @@ TWISTED_TESTS = \
caps/advertise-draft1.py \
caps/advertise-legacy.py \
caps/caps-cache.py \
+ caps/compat-bundles.py \
caps/from-bare-jid.py \
caps/hashed-caps.py \
caps/initial-caps.py \
diff --git a/tests/twisted/caps/compat-bundles.py b/tests/twisted/caps/compat-bundles.py
new file mode 100644
index 0000000..ab9cdb5
--- /dev/null
+++ b/tests/twisted/caps/compat-bundles.py
@@ -0,0 +1,52 @@
+"""
+Check that Gabble always responds to disco for voice-v1 and video-v1. They have
+hard-coded contents, because they only exist for compatibility with
+Google Talk, Google Video Chat, and old versions of Gabble.
+
+In particular, if the appropriate capabilities are not enabled (as in this
+test), doing disco on the bundles still gives their contents.
+"""
+
+import dbus
+
+from twisted.words.xish import xpath, domish
+
+from servicetest import EventPattern, assertEquals
+from gabbletest import exec_test
+import constants as cs
+import ns
+
+def disco_bundle(q, bus, conn, stream, node, features):
+
+ request = """
+<iq from='fake_contact at jabber.org/resource'
+ id='disco1'
+ to='gabble at jabber.org/resource'
+ type='get'>
+ <query xmlns='""" + ns.DISCO_INFO + """'
+ node='""" + node + """'/>
+</iq>
+"""
+ stream.send(request)
+
+ disco_response = q.expect('stream-iq', query_ns=ns.DISCO_INFO)
+ nodes = xpath.queryForNodes('/iq/query/feature', disco_response.stanza)
+ vars = [n["var"] for n in nodes]
+ assertEquals(set(features), set(vars))
+
+def run_test(q, bus, conn, stream):
+ conn.Connect()
+ event_stream = q.expect('stream-presence')
+
+ c_nodes = xpath.queryForNodes('/presence/c', event_stream.stanza)
+ assert c_nodes is not None
+ assert len(c_nodes) == 1
+ node = c_nodes[0].attributes['node']
+
+ disco_bundle(q, bus, conn, stream, node + '#voice-v1',
+ set([ns.GOOGLE_FEAT_VOICE]))
+ disco_bundle(q, bus, conn, stream, node + '#video-v1',
+ set([ns.GOOGLE_FEAT_VIDEO]))
+
+if __name__ == '__main__':
+ exec_test(run_test)
--
1.5.6.5
More information about the telepathy-commits
mailing list