diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2013-04-30 14:35:11 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2013-04-30 14:47:51 +0100 |
commit | 97dcd4e6a110c426cfd620dd03fc368e75bb5924 (patch) | |
tree | a7656fe6e02f1a6f71b1c63a3cd0df37f58f8220 | |
parent | 43f86291262aeb29d81532bd6d11d91d152e5f36 (diff) |
Add (failing?) tests
-rw-r--r-- | tests/twisted/Makefile.am | 2 | ||||
-rw-r--r-- | tests/twisted/connect/connect-close-ssl.py | 28 | ||||
-rw-r--r-- | tests/twisted/connect/disconnect-during-cert-verification.py | 28 |
3 files changed, 58 insertions, 0 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index 684918f..6063454 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -1,10 +1,12 @@ TWISTED_TESTS = \ cm/protocol.py \ + connect/connect-close-ssl.py \ connect/connect-success.py \ connect/connect-success-ssl.py \ connect/connect-reject-ssl.py \ connect/connect-fail.py \ connect/connect-fail-ssl.py \ + connect/disconnect-during-cert-verification.py \ connect/ping.py \ connect/server-quit-ignore.py \ connect/server-quit-noclose.py \ diff --git a/tests/twisted/connect/connect-close-ssl.py b/tests/twisted/connect/connect-close-ssl.py new file mode 100644 index 0000000..6fecd50 --- /dev/null +++ b/tests/twisted/connect/connect-close-ssl.py @@ -0,0 +1,28 @@ + +""" +Test connecting to a SSL server. +""" + +import dbus +import constants as cs +from idletest import exec_test, SSLIRCServer +from servicetest import EventPattern, wrap_channel + +def test(q, bus, conn, stream): + conn.Connect() + q.expect_many( + EventPattern('dbus-signal', signal='StatusChanged', args=[1, 1]), + EventPattern('irc-connected')) + e = q.expect('dbus-signal', signal='NewChannels') + channels = e.args[0] + path, props = channels[0] + + channel = wrap_channel(bus.get_object(conn.bus_name, path), + cs.CHANNEL_TYPE_SERVER_TLS_CONNECTION) + channel.Close() + + q.expect('dbus-signal', signal='StatusChanged', args=[2, 2]) + +if __name__ == '__main__': + exec_test(test, {'use-ssl':dbus.Boolean(True)}, protocol=SSLIRCServer) + diff --git a/tests/twisted/connect/disconnect-during-cert-verification.py b/tests/twisted/connect/disconnect-during-cert-verification.py new file mode 100644 index 0000000..83fe004 --- /dev/null +++ b/tests/twisted/connect/disconnect-during-cert-verification.py @@ -0,0 +1,28 @@ +""" +Test disconnecting while a certificate verification channel is open. +""" + +import dbus +import constants as cs +from idletest import exec_test, SSLIRCServer +from servicetest import EventPattern, sync_dbus + +def test(q, bus, conn, stream): + conn.Connect() + q.expect_many( + EventPattern('dbus-signal', signal='StatusChanged', args=[1, 1]), + EventPattern('irc-connected')) + e = q.expect('dbus-signal', signal='NewChannels') + + conn.Disconnect() + q.expect_many( + EventPattern('dbus-signal', signal='StatusChanged'), + EventPattern('irc-disconnected'), + ) + + # Idle would now crash in an idle callback; so let's see if it's alive. + sync_dbus(bus, q, conn) + +if __name__ == '__main__': + exec_test(test, {'use-ssl':dbus.Boolean(True)}, protocol=SSLIRCServer) + |