[telepathy-gabble/master] check if Gabble raises the right error if we pass an invalid access_control to Offer/Accept

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Mon May 25 10:03:41 PDT 2009


---
 tests/twisted/tubes/accept-private-dbus-tube.py |   10 +++++++++-
 tests/twisted/tubes/offer-muc-dbus-tube.py      |   10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/tests/twisted/tubes/accept-private-dbus-tube.py b/tests/twisted/tubes/accept-private-dbus-tube.py
index 7e4efb4..26dd718 100644
--- a/tests/twisted/tubes/accept-private-dbus-tube.py
+++ b/tests/twisted/tubes/accept-private-dbus-tube.py
@@ -2,7 +2,7 @@
 
 import dbus
 
-from servicetest import call_async, EventPattern, sync_dbus
+from servicetest import call_async, EventPattern, sync_dbus, assertEquals
 from gabbletest import acknowledge_iq, sync_stream
 import constants as cs
 import ns
@@ -159,6 +159,14 @@ def test(q, bus, conn, stream, bytestream_cls):
     status = tube_chan.Get(cs.CHANNEL_IFACE_TUBE, 'State', dbus_interface=cs.PROPERTIES_IFACE)
     assert status == cs.TUBE_STATE_LOCAL_PENDING
 
+    # try to accept using a wrong access control
+    try:
+        dbus_tube_iface.Accept(cs.SOCKET_ACCESS_CONTROL_PORT)
+    except dbus.DBusException, e:
+        assertEquals(e.get_dbus_name(), cs.INVALID_ARGUMENT)
+    else:
+        assert False
+
     # accept the tube (new API)
     call_async(q, dbus_tube_iface, 'Accept', cs.SOCKET_ACCESS_CONTROL_CREDENTIALS)
 
diff --git a/tests/twisted/tubes/offer-muc-dbus-tube.py b/tests/twisted/tubes/offer-muc-dbus-tube.py
index b564f68..6c3263b 100644
--- a/tests/twisted/tubes/offer-muc-dbus-tube.py
+++ b/tests/twisted/tubes/offer-muc-dbus-tube.py
@@ -6,7 +6,7 @@ import dbus
 from dbus.connection import Connection
 from dbus.lowlevel import SignalMessage
 
-from servicetest import call_async, EventPattern, assertContains
+from servicetest import call_async, EventPattern, assertContains, assertEquals
 from gabbletest import exec_test, acknowledge_iq, elem
 import ns
 import constants as cs
@@ -244,6 +244,14 @@ def test(q, bus, conn, stream):
 
     assert tube_props['State'] == cs.TUBE_CHANNEL_STATE_NOT_OFFERED
 
+    # try to offer using a wrong access control
+    try:
+        dbus_tube_iface.Offer(sample_parameters, cs.SOCKET_ACCESS_CONTROL_PORT)
+    except dbus.DBusException, e:
+        assertEquals(e.get_dbus_name(), cs.INVALID_ARGUMENT)
+    else:
+        assert False
+
     # offer the tube
     call_async(q, dbus_tube_iface, 'Offer', sample_parameters, cs.SOCKET_ACCESS_CONTROL_CREDENTIALS)
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list