[Telepathy-commits] [telepathy-gabble/master] add request-invalid-dbus-tube.py

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Tue Feb 3 03:36:15 PST 2009


---
 tests/twisted/tubes/request-invalid-dbus-tube.py |   35 ++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 tests/twisted/tubes/request-invalid-dbus-tube.py

diff --git a/tests/twisted/tubes/request-invalid-dbus-tube.py b/tests/twisted/tubes/request-invalid-dbus-tube.py
new file mode 100644
index 0000000..d3a323b
--- /dev/null
+++ b/tests/twisted/tubes/request-invalid-dbus-tube.py
@@ -0,0 +1,35 @@
+import dbus
+
+from gabbletest import exec_test
+from constants import *
+
+invalid_service_names = [ 'invalidServiceName'
+                        , 'one ten hundred thousand million'
+                        , 'me.is.it.you?.hello.you.sexy.sons.o.@#$%.heh'
+                        , ':1.1'
+                        , ''
+                        ]
+
+def test(q, bus, conn, stream):
+    conn.Connect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[0L, 1L])
+
+    requestotron = dbus.Interface(conn, CONN_IFACE_REQUESTS)
+
+    for invalid_service_name in invalid_service_names:
+        try:
+            requestotron.CreateChannel(
+                    {CHANNEL_TYPE: CHANNEL_TYPE_DBUS_TUBE,
+                     TARGET_HANDLE_TYPE: HT_CONTACT,
+                     TARGET_ID: 'alice at localhost',
+                     DBUS_TUBE_SERVICE_NAME: invalid_service_name
+                });
+        except dbus.DBusException, e:
+            print e
+            assert e.get_dbus_name() == INVALID_ARGUMENT, \
+                (e.get_dbus_name(), invalid_service_name)
+        else:
+            assert False
+
+if __name__ == '__main__':
+    exec_test(test)
-- 
1.5.6.5




More information about the telepathy-commits mailing list