[Telepathy-commits] [telepathy-salut/master] Add more invalid services names to dtube request test

Will Thompson will.thompson at collabora.co.uk
Fri Feb 6 03:15:02 PST 2009


---
 .../avahi/test-request-invalid-dbus-tube.py        |   41 ++++++++++++-------
 1 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/tests/twisted/avahi/test-request-invalid-dbus-tube.py b/tests/twisted/avahi/test-request-invalid-dbus-tube.py
index 65b20a7..d940b62 100644
--- a/tests/twisted/avahi/test-request-invalid-dbus-tube.py
+++ b/tests/twisted/avahi/test-request-invalid-dbus-tube.py
@@ -18,8 +18,16 @@ from twisted.internet import reactor
 PUBLISHED_NAME="test-tube"
 
 CHANNEL_TYPE_TUBES = "org.freedesktop.Telepathy.Channel.Type.Tubes"
+C_T_DTUBE = 'org.freedesktop.Telepathy.Channel.Type.DBusTube.DRAFT'
 HT_CONTACT = 1
 
+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):
     conn.Connect()
     q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L])
@@ -27,21 +35,24 @@ def test(q, bus, conn):
     requestotron = dbus.Interface(conn,
             'org.freedesktop.Telepathy.Connection.Interface.Requests')
 
-    try:
-        requestotron.CreateChannel(
-            {'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.DBusTube.DRAFT',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType':
-                 HT_CONTACT,
-             'org.freedesktop.Telepathy.Channel.TargetID':
-                 'alice',
-             'org.freedesktop.Telepathy.Channel.Type.DBusTube.DRAFT.ServiceName':
-                'invalidServiceName'
-            });
-    except dbus.DBusException, e:
-        assert e.get_dbus_name() == 'org.freedesktop.Telepathy.Errors.InvalidArgument'
-    else:
-        assert False
+    for invalid_service_name in invalid_service_names:
+        try:
+            requestotron.CreateChannel(
+                {'org.freedesktop.Telepathy.Channel.ChannelType':
+                     C_T_DTUBE,
+                 'org.freedesktop.Telepathy.Channel.TargetHandleType':
+                     HT_CONTACT,
+                 'org.freedesktop.Telepathy.Channel.TargetID':
+                     'alice',
+                 C_T_DTUBE + '.ServiceName':
+                    invalid_service_name
+                });
+        except dbus.DBusException, e:
+            assert e.get_dbus_name() == \
+                'org.freedesktop.Telepathy.Errors.InvalidArgument', \
+                (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