diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-03-30 13:22:27 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2012-03-30 13:22:27 +0100 |
commit | 461c00a7db16b8473d64dacd2af048b8b3b480b3 (patch) | |
tree | e7e30f6060218b2ec4b9b6ae4f0fcfd2e51b3a31 /tests | |
parent | 05fa69e93345351ac193008596b5318afddd9bca (diff) | |
download | telepathy-idle-461c00a7db16b8473d64dacd2af048b8b3b480b3.tar.gz |
Connection: handle ServerConn errors while Connecting
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=48084
Diffstat (limited to 'tests')
-rw-r--r-- | tests/twisted/Makefile.am | 1 | ||||
-rw-r--r-- | tests/twisted/connect/socket-closed-during-handshake.py | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index f33c1a5..b2977fb 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-during-handshake.py \ connect/invalid-nick.py \ contacts.py \ channels/join-muc-channel.py \ diff --git a/tests/twisted/connect/socket-closed-during-handshake.py b/tests/twisted/connect/socket-closed-during-handshake.py new file mode 100644 index 0000000..dd5d569 --- /dev/null +++ b/tests/twisted/connect/socket-closed-during-handshake.py @@ -0,0 +1,24 @@ +""" +Test connecting to a server which closes the socket mid-login handshake. + +https://bugs.freedesktop.org/show_bug.cgi?id=48084 +""" + +from idletest import exec_test, BaseIRCServer + +class DropConnectionServer(BaseIRCServer): + def handleNICK(self, args, prefix): + self.transport.loseConnection() + +def test(q, bus, conn, stream): + conn.Connect() + # Idle should start to connect... + q.expect('dbus-signal', signal='StatusChanged', args=[1, 1]) + + # ...and then give up with an error when the server drops the connection + # mid-handshake. + q.expect('dbus-signal', signal='StatusChanged', args=[2, 2]) + +if __name__ == '__main__': + exec_test(test, protocol=DropConnectionServer) + |