From 2e1ddeb6547e140e9651231fedcd00e8ee4b1ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 14 Jun 2020 22:54:42 +0200 Subject: Implement SASL plain authentication --- tests/end_to_end/scenarios/sasl.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/end_to_end/scenarios/sasl.py (limited to 'tests/end_to_end/scenarios/sasl.py') diff --git a/tests/end_to_end/scenarios/sasl.py b/tests/end_to_end/scenarios/sasl.py new file mode 100644 index 0000000..5f71b7a --- /dev/null +++ b/tests/end_to_end/scenarios/sasl.py @@ -0,0 +1,34 @@ +from scenarios import * + +scenario = ( + send_stanza(""), + sequences.connection(), + + simple_channel_join.expect_self_join_presence(jid = '{jid_one}/{resource_one}', chan = "#foo", nick = "RegisteredUser"), + + # Create an account by talking to nickserv directly + send_stanza("register P4SSW0RD"), + expect_stanza("/message/body[text()='Account created']"), + expect_stanza("/message/body[text()=\"You're now logged in as RegisteredUser\"]"), + send_stanza(""), + expect_stanza("/presence[@type='unavailable']"), + + # Configure an sasl 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("" + "" + "" + "P4SSW0RD" + "6667" + "RegisteredUser" + "66976670" + ""), + 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") +) -- cgit v1.2.3