[Telepathy-commits] [telepathy-salut/master] Basic test for SetSelfCapabilities

Alban Crequy alban.crequy at collabora.co.uk
Thu Feb 26 11:20:05 PST 2009


---
 tests/twisted/Makefile.am             |    1 +
 tests/twisted/avahi/test-caps-self.py |   44 +++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)
 create mode 100644 tests/twisted/avahi/test-caps-self.py

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index d61a656..50a6a15 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -25,6 +25,7 @@ TWISTED_AVAHI_TESTS = \
 	avahi/test-receive-file-cancelled-immediately.py \
 	avahi/test-receive-file-decline.py \
 	avahi/test-receive-file-not-found.py \
+	avahi/test-caps-self.py \
 	avahi/test-text-channel.py \
 	avahi/test-ichat-composing.py \
 	avahi/test-ichat-incoming-msg.py \
diff --git a/tests/twisted/avahi/test-caps-self.py b/tests/twisted/avahi/test-caps-self.py
new file mode 100644
index 0000000..a2d8397
--- /dev/null
+++ b/tests/twisted/avahi/test-caps-self.py
@@ -0,0 +1,44 @@
+"""
+Basic test of SetSelfCapabilities on interface
+org.freedesktop.Telepathy.Connection.Interface.ContactCapabilities.DRAFT
+"""
+
+from saluttest import exec_test
+from avahitest import AvahiAnnouncer, AvahiListener
+from avahitest import get_host_name
+import avahi
+
+from xmppstream import setup_stream_listener, connect_to_stream
+from servicetest import make_channel_proxy
+
+from twisted.words.xish import xpath, domish
+
+import time
+import dbus
+
+HT_CONTACT = 1
+caps_iface = 'org.freedesktop.Telepathy.' + \
+             'Connection.Interface.ContactCapabilities.DRAFT'
+
+def test(q, bus, conn):
+    conn.Connect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L])
+
+    self_handle = conn.GetSelfHandle()
+    self_handle_name =  conn.InspectHandles(HT_CONTACT, [self_handle])[0]
+
+    AvahiListener(q).listen_for_service("_presence._tcp")
+    e = q.expect('service-added', name = self_handle_name,
+        protocol = avahi.PROTO_INET)
+    service = e.service
+    service.resolve()
+
+    e = q.expect('service-resolved', service = service)
+
+    conn_caps_iface = dbus.Interface(conn, caps_iface)
+
+    # Advertise nothing
+    conn_caps_iface.SetSelfCapabilities([])
+
+if __name__ == '__main__':
+    exec_test(test)
-- 
1.5.6.5




More information about the telepathy-commits mailing list