From 063e6b127ecf92ca5bf8c4ecb137b60e3e7aa216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 12 Aug 2020 09:40:36 +0200 Subject: Handle SASL failures by displaying a message and aborting the connection --- tests/end_to_end/scenarios/sasl.py | 42 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/end_to_end/scenarios/sasl.py b/tests/end_to_end/scenarios/sasl.py index 5f71b7a..b3cc62d 100644 --- a/tests/end_to_end/scenarios/sasl.py +++ b/tests/end_to_end/scenarios/sasl.py @@ -26,9 +26,47 @@ scenario = ( "6667" "RegisteredUser" "66976670" + "9999" ""), expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']"), - send_stanza(""), - sequences.connection(login="RegisteredUser") + # Joining a channel with the associated nick will work + send_stanza(""), + sequences.connection(login="RegisteredUser"), + expect_stanza("/presence"), + expect_stanza("/message/subject"), + + # Leave the channel and disconnect from the server to try again differently + send_stanza(""), + expect_stanza("/presence[@type='unavailable']"), + + # Configure an INCORRECT password + send_stanza(""), + expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@sessionid][@status='executing']", + "/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='text-private'][@var='sasl_password']", + after = save_value("sessionid", extract_attribute("/iq[@type='result']/commands:command[@node='configure']", "sessionid"))), + + + send_stanza("" + "" + "" + "wrong wrong wrong" + "6667" + "RegisteredUser" + "66976670" + "9999" + ""), + expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']"), + + send_stanza(""), + # Here, the 6 connecting… connected messages from the connection attempt + expect_stanza("/message"), + expect_stanza("/message"), + expect_stanza("/message"), + expect_stanza("/message"), + expect_stanza("/message"), + expect_stanza("/message"), + expect_stanza("/presence[@type='error'][@from='#foo%{irc_server_one}/RegisteredUser']"), + expect_stanza("/message/body[text()='ERROR: Quit: SASL authentication failed: Invalid account credentials']"), + expect_stanza("/message/body[text()='ERROR: Connection closed.']"), ) -- cgit v1.2.3