[telepathy-gabble/master] Add the beginnings of a contact search test

Will Thompson will.thompson at collabora.co.uk
Wed Aug 26 09:21:45 PDT 2009


---
 tests/twisted/Makefile.am          |    1 +
 tests/twisted/constants.py         |    3 ++
 tests/twisted/search/unextended.py |   38 ++++++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 0 deletions(-)
 create mode 100644 tests/twisted/search/unextended.py

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index f185c28..1e49d6a 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -43,6 +43,7 @@ TWISTED_TESTS = \
 	roster/test-roster-item-deletion.py \
 	roster/test-roster-subscribe.py \
 	roster/test-save-alias-to-roster.py \
+	search/unextended.py \
 	text/initiate.py \
 	text/initiate-requestotron.py \
 	text/destroy.py \
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index 16f79ed..3bfd702 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -23,6 +23,7 @@ CHANNEL_IFACE_PASSWORD = CHANNEL + ".Interface.Password"
 CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube"
 
 CHANNEL_TYPE_CONTACT_LIST = CHANNEL + ".Type.ContactList"
+CHANNEL_TYPE_CONTACT_SEARCH = CHANNEL + ".Type.ContactSearch.DRAFT"
 CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text"
 CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
 CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube"
@@ -77,6 +78,8 @@ DBUS_TUBE_SERVICE_NAME = CHANNEL_TYPE_DBUS_TUBE + '.ServiceName'
 DBUS_TUBE_DBUS_NAMES = CHANNEL_TYPE_DBUS_TUBE + '.DBusNames'
 DBUS_TUBE_SUPPORTED_ACCESS_CONTROLS = CHANNEL_TYPE_DBUS_TUBE + '.SupportedAccessControls'
 
+CONTACT_SEARCH_SERVER = CHANNEL_TYPE_CONTACT_SEARCH + '.Server'
+
 TUBE_CHANNEL_STATE_LOCAL_PENDING = 0
 TUBE_CHANNEL_STATE_REMOTE_PENDING = 1
 TUBE_CHANNEL_STATE_OPEN = 2
diff --git a/tests/twisted/search/unextended.py b/tests/twisted/search/unextended.py
new file mode 100644
index 0000000..7198e8c
--- /dev/null
+++ b/tests/twisted/search/unextended.py
@@ -0,0 +1,38 @@
+"""
+Tests Contact Search channels to a simulated XEP-0055 service, without
+extensibility via Data Forms
+"""
+
+import dbus
+
+from gabbletest import exec_test
+from servicetest import call_async, unwrap
+
+import constants as cs
+
+server = 'jud.localhost'
+
+def test(q, bus, conn, stream):
+    conn.Connect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
+
+    requests = dbus.Interface(conn, cs.CONN_IFACE_REQUESTS)
+    request = dbus.Dictionary(
+        {
+            cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_SEARCH,
+            cs.CONTACT_SEARCH_SERVER: server,
+        }, signature='sv')
+    call_async(q, requests, 'CreateChannel', request)
+
+    # Gabble should disco the server here.
+
+    ret = q.expect('dbus-return', method='CreateChannel')
+    sig = q.expect('dbus-signal', signal='NewChannels')
+
+    path, props = ret.value
+
+    conn.Disconnect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
+
+if __name__ == '__main__':
+    exec_test(test)
-- 
1.5.6.5




More information about the telepathy-commits mailing list