Commit efb695be authored by louiz’'s avatar louiz’

e2e: Implicitely include the handshake in all tests

Instead of having to write it manually everytime
parent 17366413
......@@ -292,7 +292,10 @@ def get_scenarios(test_path, provided_scenar_names):
conf = "basic"
if hasattr(mod, "conf"):
conf = mod.conf
scenarios.append(Scenario(module_name, mod.scenario, conf))
# Every scenario needs to start with the handshake sequence.
# Instead of repeating it everytime, we add it implicitely. This
# is done here.
scenarios.append(Scenario(module_name, (sequences.handshake(),) + mod.scenario, conf))
return scenarios
......
from scenarios import *
# At the start of every scenario, we automatically insert a
# sequences.handshake() call. So, this scenario is just here to test that
# this basic thing works fine.
scenario = (
sequences.handshake(),
)
from scenarios import *
scenario = (
sequences.handshake(),
# Mutual subscription exchange
send_stanza("<presence from='{jid_one}' to='{biboumi_host}' type='subscribe' id='subid1' />"),
......
......@@ -3,7 +3,7 @@ from scenarios import *
conf = "fixed_server"
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo@{biboumi_host}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}', fixed_irc_server=True),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
......
......@@ -3,7 +3,6 @@ from scenarios import *
from scenarios.simple_channel_join import expect_self_join_presence
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_self_join_presence(jid = '{jid_one}/{resource_one}', chan = "#foo", nick = "{nick_one}"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#true\\2ffalse%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #true/false [+nt] by {irc_host_one}']"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#aaa%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
......
from scenarios import *
scenario = (
sequences.handshake(),
# Configure the throttle option with an incorrect value
send_stanza("<iq type='set' id='id1' 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']",
......
......@@ -11,8 +11,6 @@ def incr_counter():
counter = incr_counter()
scenario = (
sequences.handshake(),
# Disable the throttling, otherwise it’s way too long
send_stanza("<iq type='set' id='id1' 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']",
......
from scenarios import *
scenario = (
sequences.handshake(),
# Disable the throttling, otherwise it’s way too long
send_stanza("<iq type='set' id='id1' 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']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#biboumi\\40louiz.org\\3a80%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #biboumi@louiz.org:80 [+nt] by {irc_host_one}']"),
......
......@@ -3,8 +3,6 @@ from scenarios import *
from scenarios.simple_channel_join import expect_self_join_presence
scenario = (
sequences.handshake(),
# Admin connects to first server
send_stanza("<presence from='{jid_admin}/{resource_one}' to='#bar%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_admin}/{resource_one}'),
......
......@@ -3,7 +3,6 @@ from scenarios import *
from scenarios.simple_channel_join import expect_self_join_presence
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_admin}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_admin}/{resource_one}'),
expect_self_join_presence(jid = '{jid_admin}/{resource_one}', chan = "#foo", nick = "{nick_one}"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='command1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><command xmlns='http://jabber.org/protocol/commands' node='disconnect-user' action='execute' /></iq>"),
expect_stanza("/iq[@type='error'][@id='command1']/commands:command[@node='disconnect-user']",
"/iq/commands:command/commands:error[@type='cancel']/stanza:forbidden"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='hello-command1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><command xmlns='http://jabber.org/protocol/commands' node='hello' action='execute' /></iq>"),
expect_stanza("/iq[@type='result']/commands:command[@node='hello'][@sessionid][@status='executing']",
"/iq/commands:command/dataform:x[@type='form']/dataform:title[text()='Configure your name.']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='hello-command1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><command xmlns='http://jabber.org/protocol/commands' node='hello' action='execute' /></iq>"),
expect_stanza("/iq[@type='result']/commands:command[@node='hello'][@sessionid][@status='executing']",
"/iq/commands:command/commands:actions/commands:complete",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='ping-command1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><command xmlns='http://jabber.org/protocol/commands' node='ping' action='execute' /></iq>"),
expect_stanza("/iq[@type='result']/commands:command[@node='ping'][@status='completed']/commands:note[@type='info'][text()='Pong']")
)
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='ping-command1' from='{jid_admin}/{resource_one}' to='{biboumi_host}'><command xmlns='http://jabber.org/protocol/commands' node='reload' action='execute' /></iq>"),
expect_stanza("/iq[@type='result']/commands:command[@node='reload'][@status='completed']/commands:note[@type='info'][text()='Configuration reloaded.']"),
)
......@@ -3,7 +3,6 @@ from scenarios import *
conf = 'fixed_server'
scenario = (
sequences.handshake(),
send_stanza("<presence type='subscribe' from='{jid_one}/{resource_one}' to='{biboumi_host}' id='sub1' />"),
expect_stanza("/presence[@to='{jid_one}'][@from='{biboumi_host}'][@type='subscribed']")
)
......@@ -3,8 +3,6 @@ from scenarios import *
conf = 'fixed_server'
scenario = (
sequences.handshake(),
send_stanza("<iq from='{jid_one}/{resource_one}' to='#foo@{biboumi_host}' id='1' type='get'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>"),
expect_stanza("/iq[@from='#foo@{biboumi_host}'][@to='{jid_one}/{resource_one}'][@type='result']/disco_info:query",
"/iq[@type='result']/disco_info:query/disco_info:identity[@category='conference'][@type='irc'][@name='#foo on {irc_host_one}']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='command1' from='{jid_one}/{resource_one}' to='{irc_server_one}'><command xmlns='http://jabber.org/protocol/commands' node='get-irc-connection-info' action='execute' /></iq>"),
expect_stanza("/iq/commands:command/commands:note[text()='You are not connected to the IRC server irc.localhost']"),
......
......@@ -3,8 +3,6 @@ from scenarios import *
conf = 'fixed_server'
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='command1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><command xmlns='http://jabber.org/protocol/commands' node='get-irc-connection-info' action='execute' /></iq>"),
expect_stanza("/iq/commands:command/commands:note[text()='You are not connected to the IRC server irc.localhost']"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='id1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><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:title[text()='Configure some global default settings.']",
......
......@@ -3,7 +3,6 @@ from scenarios import *
conf = 'fixed_server'
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='id1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><command xmlns='http://jabber.org/protocol/commands' node='global-configure' action='execute' /></iq>"),
expect_stanza("/iq[@type='result']/commands:command[@node='global-configure'][@sessionid][@status='executing']",
"/iq/commands:command/dataform:x[@type='form']/dataform:title[text()='Configure some global default settings.']",
......
......@@ -3,7 +3,6 @@ from scenarios import *
conf='persistent_by_default'
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='id1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><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:title[text()='Configure some global default settings.']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='id1' from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}'><command xmlns='http://jabber.org/protocol/commands' node='configure' action='execute'><dummy/></command></iq>"),
expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@sessionid][@status='executing']",
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='text-single'][@var='encoding_in']",
......
......@@ -3,7 +3,6 @@ from scenarios import *
conf = 'fixed_server'
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='id1' from='{jid_one}/{resource_one}' to='#foo@{biboumi_host}'><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-single'][@var='encoding_in']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='get' id='id1' from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}'><query xmlns='http://jabber.org/protocol/muc#owner'/></iq>"),
expect_stanza("/iq[@type='result']/muc_owner:query",
"/iq/muc_owner:query/dataform:x[@type='form']/dataform:field[@type='text-single'][@var='encoding_in']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='set' id='id1' 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:title[text()='Configure the IRC server irc.localhost']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection(),
)
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%doesnotexist@{biboumi_host}/{nick_one}' />"),
expect_stanza("/message/body[text()='Connecting to doesnotexist:6697 (encrypted)']"),
expect_stanza("/message/body[re:test(text(), 'Connection failed: (Domain name not found|Name or service not known)')]"),
......
from scenarios import *
scenario = (
sequences.handshake(),
# Mutual subscription exchange
send_stanza("<presence from='{jid_one}' to='{irc_server_one}' type='subscribe' id='subid1' />"),
expect_stanza("/presence[@type='subscribed'][@id='subid1']"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence type='subscribe' from='{jid_one}/{resource_one}' to='{irc_server_one}' id='sub1' />"),
expect_stanza("/presence[@to='{jid_one}'][@from='{irc_server_one}'][@type='subscribed']"),
)
from scenarios import *
scenario = (
sequences.handshake(),
# First, use an adhoc command to configure how we connect to the irc server, configure
# only one TLS port, and disable the cert verification.
send_stanza("<iq type='set' id='id1' from='{jid_one}/{resource_one}' to='{irc_server_one}'><command xmlns='http://jabber.org/protocol/commands' node='configure' action='execute' /></iq>"),
......
from scenarios import *
scenario = (
sequences.handshake(),
# Disable the throttling because the test is based on timings
send_stanza("<iq type='set' id='id1' 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']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='get' id='idwhatever' from='{jid_one}/{resource_one}' to='{biboumi_host}'><query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/commands' /></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']",
"/iq/disco_items:query/disco_items:item[@node='configure']",
......
......@@ -3,7 +3,6 @@ from scenarios import *
conf = "fixed_server"
scenario = (
sequences.handshake(),
send_stanza("<iq type='get' id='idwhatever' from='{jid_one}/{resource_one}' to='{biboumi_host}'><query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/commands' /></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']",
"/iq/disco_items:query/disco_items:item[@node='global-configure']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='get' id='idwhatever' from='{jid_one}/{resource_one}' to='{irc_host_one}@{biboumi_host}'><query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/commands' /></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']",
"/iq/disco_items:query/disco_items:item[2]",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='get' id='idwhatever' from='{jid_admin}/{resource_one}' to='{biboumi_host}'><query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/commands' /></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']",
"/iq/disco_items:query/disco_items:item[@node='configure']",
......
......@@ -3,7 +3,6 @@ from scenarios import *
conf = "fixed_server"
scenario = (
sequences.handshake(),
send_stanza("<iq type='get' id='idwhatever' from='{jid_admin}/{resource_one}' to='{biboumi_host}'><query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/commands' /></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']",
"/iq/disco_items:query/disco_items:item[@node='global-configure']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='get' id='idwhatever' from='{jid_admin}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}'><query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/commands' /></iq>"),
expect_stanza("/iq[@type='error']/error[@type='cancel']/stanza:feature-not-implemented"),
)
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' id='1' type='get'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>"),
expect_stanza("/iq[@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}'][@type='result']/disco_info:query",
"/iq[@type='result']/disco_info:query/disco_info:identity[@category='conference'][@type='irc'][@name='#foo on {irc_host_one}']",
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' id='1' type='get'><query xmlns='http://jabber.org/protocol/disco#info' node='http://jabber.org/protocol/muc#traffic'/></iq>"),
expect_stanza("/iq[@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}'][@type='result']/disco_info:query[@node='http://jabber.org/protocol/muc#traffic']"),
)
......@@ -3,8 +3,6 @@ from scenarios import *
from scenarios.simple_channel_join import expect_self_join_presence
scenario = (
sequences.handshake(),
# Join 3 rooms, on the same server, with three different nicks
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#bar%{irc_server_one}/{nick_two}' />"),
......
......@@ -3,8 +3,6 @@ from scenarios import *
from scenarios.simple_channel_join import expect_self_join_presence
scenario = (
sequences.handshake(),
# Resource one joins a channel
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection(),
......
......@@ -3,7 +3,6 @@ from scenarios import *
from scenarios.simple_channel_join import expect_self_join_presence
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection(),
expect_self_join_presence(jid = '{jid_one}/{resource_one}', chan = "#foo", nick = "{nick_one}"),
......
......@@ -3,7 +3,6 @@ from scenarios import *
from scenarios.simple_channel_join import expect_self_join_presence
scenario = (
sequences.handshake(),
send_stanza("<presence type='unavailable' from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
# Fixme: what is the purpose of this test? Check that we don’t receive anything here…?
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
......
......@@ -3,8 +3,6 @@ from scenarios import *
conf = 'fixed_server'
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}', fixed_irc_server=True),
expect_stanza("/message"),
......
......@@ -2,7 +2,6 @@ from scenarios import *
scenario = (
# Join the channel
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
......
from scenarios import *
scenario = (
sequences.handshake(),
send_stanza("<iq type='get' id='get1' from='{jid_one}/{resource_one}' to='{biboumi_host}'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>"),
expect_stanza("/iq[@type='result']/disco_info:query/disco_info:identity[@category='conference'][@type='irc'][@name='Biboumi XMPP-IRC gateway']",
"/iq/disco_info:query/disco_info:feature[@var='jabber:iq:version']",
......
......@@ -12,7 +12,6 @@ def expect_self_join_presence(jid, chan, nick, irc_server="{irc_server_one}"):
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
sequences.connection(),
......
......@@ -3,7 +3,6 @@ from scenarios import *
conf = "fixed_server"
scenario = (
sequences.handshake(),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo@{biboumi_host}/{nick_one}' />"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}', fixed_irc_server=True),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment