summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-03-30 13:24:34 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2012-03-30 13:24:34 +0100
commit529606d547089bd4f6c6e7520fb96af7d1ffe23a (patch)
tree7c225c2e1044704cb0c1a643beb020863919b7df /tests
parent461c00a7db16b8473d64dacd2af048b8b3b480b3 (diff)
Test server dropping connection after authentication.
This has always worked fine, but wasn't tested.
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/Makefile.am1
-rw-r--r--tests/twisted/connect/socket-closed-after-handshake.py23
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index b2977fb..64cb611 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -6,6 +6,7 @@ TWISTED_TESTS = \
connect/connect-fail-ssl.py \
connect/server-quit-ignore.py \
connect/server-quit-noclose.py \
+ connect/socket-closed-after-handshake.py \
connect/socket-closed-during-handshake.py \
connect/invalid-nick.py \
contacts.py \
diff --git a/tests/twisted/connect/socket-closed-after-handshake.py b/tests/twisted/connect/socket-closed-after-handshake.py
new file mode 100644
index 0000000..ece4c6c
--- /dev/null
+++ b/tests/twisted/connect/socket-closed-after-handshake.py
@@ -0,0 +1,23 @@
+"""
+Test what happens if the server just abruptly disconnects.
+"""
+
+from idletest import exec_test
+from servicetest import EventPattern
+import constants as cs
+
+def test(q, bus, conn, stream):
+ conn.Connect()
+ q.expect_many(
+ EventPattern('irc-connected'),
+ EventPattern('dbus-signal', signal='StatusChanged',
+ args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]),
+ )
+
+ stream.transport.loseConnection()
+ q.expect('dbus-signal', signal='StatusChanged',
+ args=[cs.CONN_STATUS_DISCONNECTED, cs.CSR_NETWORK_ERROR])
+
+if __name__ == '__main__':
+ exec_test(test)
+