[telepathy-gabble/master] add connect/disconnect-timeout.py

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 11 07:56:21 PDT 2009


---
 tests/twisted/Makefile.am                   |    1 +
 tests/twisted/connect/disconnect-timeout.py |   26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 tests/twisted/connect/disconnect-timeout.py

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index d240600..f645668 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -131,6 +131,7 @@ TWISTED_TESTS = \
 	file-transfer/test-send-file-to-unknown-contact.py \
 	file-transfer/test-send-file-wait-to-provide.py \
 	test-debug.py \
+	connect/disconnect-timeout.py \
 	connect/multiple-times-to-same-account.py \
 	connect/test-fail.py \
 	connect/test-success.py \
diff --git a/tests/twisted/connect/disconnect-timeout.py b/tests/twisted/connect/disconnect-timeout.py
new file mode 100644
index 0000000..975c8d1
--- /dev/null
+++ b/tests/twisted/connect/disconnect-timeout.py
@@ -0,0 +1,26 @@
+"""
+Disconnect the connection but the server doesn't send its stream close stanza.
+After a while Gabble gives up, force the closing and the Disconnect
+D-Bus call returns.
+"""
+
+from gabbletest import exec_test
+from servicetest import call_async, EventPattern
+import constants as cs
+
+def test(q, bus, conn, stream):
+    conn.Connect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
+
+    call_async(q, conn, 'Disconnect')
+
+    q.expect_many(
+        EventPattern('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_DISCONNECTED, cs.CSR_REQUESTED]),
+        EventPattern('stream-closed'))
+
+    q.expect('dbus-return', method='Disconnect')
+
+
+if __name__ == '__main__':
+    # Gabble will time out after 5 seconds
+    exec_test(test, timeout=10)
-- 
1.5.6.5




More information about the telepathy-commits mailing list