summaryrefslogtreecommitdiff
path: root/tests/end_to_end/scenarios
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2020-08-12 09:40:36 +0200
committerlouiz’ <louiz@louiz.org>2020-08-12 09:40:36 +0200
commit063e6b127ecf92ca5bf8c4ecb137b60e3e7aa216 (patch)
tree7e9898c0f100d87c3480016b3ec5400828469116 /tests/end_to_end/scenarios
parent4d6fdb0795b0d7e306988c6ff32f51545c2fd7f4 (diff)
downloadbiboumi-9.0-rc1.tar.gz
biboumi-9.0-rc1.tar.bz2
biboumi-9.0-rc1.tar.xz
biboumi-9.0-rc1.zip
Handle SASL failures by displaying a message and aborting the connection9.0-rc1
Diffstat (limited to 'tests/end_to_end/scenarios')
-rw-r--r--tests/end_to_end/scenarios/sasl.py42
1 files changed, 40 insertions, 2 deletions
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 = (
"<field var='ports'><value>6667</value></field>"
"<field var='nick'><value>RegisteredUser</value></field>"
"<field var='tls_ports'><value>6697</value><value>6670</value></field>"
+ "<field var='throttle_limit'><value>9999</value></field>"
"</x></command></iq>"),
expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']"),
- send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
- sequences.connection(login="RegisteredUser")
+ # Joining a channel with the associated nick will work
+ send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/ignored' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
+ 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("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/RegisteredUser' type='unavailable' />"),
+ expect_stanza("/presence[@type='unavailable']"),
+
+ # Configure an INCORRECT password
+ send_stanza("<iq type='set' id='id3' from='{jid_one}/{resource_one}' to='{irc_server_one}'><command xmlns='http://jabber.org/protocol/commands' node='configure' action='execute' /></iq>"),
+ 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("<iq type='set' id='id4' from='{jid_one}/{resource_one}' to='{irc_server_one}'>"
+ "<command xmlns='http://jabber.org/protocol/commands' node='configure' sessionid='{sessionid}' action='complete'>"
+ "<x xmlns='jabber:x:data' type='submit'>"
+ "<field var='sasl_password'><value>wrong wrong wrong</value></field>"
+ "<field var='ports'><value>6667</value></field>"
+ "<field var='nick'><value>RegisteredUser</value></field>"
+ "<field var='tls_ports'><value>6697</value><value>6670</value></field>"
+ "<field var='throttle_limit'><value>9999</value></field>"
+ "</x></command></iq>"),
+ expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']"),
+
+ send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/ignored' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
+ # 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.']"),
)