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" "9999" ""), expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']"), # 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']"), # Leave the same password, but remove the Nick 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" "" "66976670" "9999" ""), expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']"), # Joining a channel with the associated nick will work, it will use the one from our 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.']"), )