From 99410007adb80447a8bc83053804fa1855bb1e9f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 29 May 2013 12:05:09 +0100 Subject: [PATCH 4/4] Add a regression test for fd.o #65036 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65036 --- tests/twisted/Makefile.am | 1 + tests/twisted/tls/legacy-jabber.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/twisted/tls/legacy-jabber.py diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index ba5dcad..ae24bd1 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -120,6 +120,7 @@ TWISTED_TESTS = \ text/test-text-delayed.py \ text/test-text-no-body.py \ text/test-text.py \ + tls/legacy-jabber.py \ tls/server-tls-channel.py \ version.py \ $(NULL) diff --git a/tests/twisted/tls/legacy-jabber.py b/tests/twisted/tls/legacy-jabber.py new file mode 100644 index 0000000..e2090bb --- /dev/null +++ b/tests/twisted/tls/legacy-jabber.py @@ -0,0 +1,36 @@ +""" +fd.o #65036: connecting to legacy Jabber servers should respect + require-encryption +""" + +from servicetest import assertEquals +from gabbletest import exec_test, JabberXmlStream, JabberAuthenticator +import constants as cs + +JID = 'alice@example.com' +PASSWORD = 's3kr1t' + +def test_require_encryption(q, bus, conn, stream): + conn.Connect() + q.expect('dbus-signal', signal='StatusChanged', + args=[cs.CONN_STATUS_CONNECTING, cs.CSR_REQUESTED]) + + # FIXME: arrange to get a better error + new = q.expect('dbus-signal', signal='ConnectionError') + assertEquals(cs.NETWORK_ERROR, new.args[0]) + + q.expect('dbus-signal', signal='StatusChanged', + args=[cs.CONN_STATUS_DISCONNECTED, cs.CSR_NETWORK_ERROR]) + +if __name__ == '__main__': + exec_test(test_require_encryption, + { + 'password': PASSWORD, + 'account': JID, + 'require-encryption': True, + 'old-ssl': False, + 'resource': 'legacy-require-encryption', + }, + protocol=JabberXmlStream, + authenticator=JabberAuthenticator(JID.split('@')[0], PASSWORD), + do_connect=False) -- 1.7.10.4