from scenarios import * def incr_counter(): counter = -1 def f(stanza): nonlocal counter counter += 1 return counter return f counter = incr_counter() scenario = ( # Disable the throttling, otherwise it’s way too long send_stanza(""), expect_stanza("/iq[@type='result']", after = save_value("sessionid", extract_attribute("/iq[@type='result']/commands:command[@node='configure']", "sessionid"))), send_stanza("" "" "" "6667" "66976670" "9999" ""), expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']", after = save_value("counter", counter)), send_stanza(""), sequences.connection(), scenarios.simple_channel_join.expect_self_join_presence(jid = '{jid_one}/{resource_one}', chan = "#foo", nick = "{nick_one}"), ( send_stanza(""), expect_stanza("/presence", after = save_value("counter", counter)), expect_stanza("/message"), ) * 110, send_stanza(""), expect_stanza("count(/iq/disco_items:query/disco_items:item[@jid])=100") )