Commit 1b72faef authored by louiz’'s avatar louiz’

Update the tests to work with oragono

parent 81fb7389
......@@ -6,7 +6,6 @@ scenario = (
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo@{biboumi_host}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}', fixed_irc_server=True),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo@{biboumi_host}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo@{biboumi_host}'][@type='groupchat']/subject[not(text())]"),
......
......@@ -12,7 +12,7 @@ scenario = (
# Second user tries to join, without a password (error ensues)
send_stanza("<presence from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}'><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_two}/{resource_one}'),
expect_stanza("/message/body[text()='{irc_host_one}: #foo: Cannot join channel (+k) - bad key']"),
expect_stanza("/message/body[text()='{irc_host_one}: #foo: Cannot join channel (+k)']"),
expect_stanza("/presence[@type='error'][@from='#foo%{irc_server_one}/{nick_two}']/error[@type='auth']/stanza:not-authorized"),
# Second user joins, with the correct password (success)
......
......@@ -3,7 +3,6 @@ from scenarios import *
scenario = (
send_stanza("<presence from='{jid_one}/{resource_one}' to='#true\\2ffalse%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #true/false [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#true\\2ffalse%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#true\\2ffalse%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
......
......@@ -4,12 +4,10 @@ scenario = (
scenarios.simple_channel_join.scenario,
send_stanza("<presence from='{jid_one}/{resource_one}' to='#bar%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message/body[text()='Mode #bar [+nt] by {irc_host_one}']"),
expect_stanza("/presence"),
expect_stanza("/message[@from='#bar%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#coucou%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message/body[text()='Mode #coucou [+nt] by {irc_host_one}']"),
expect_stanza("/presence"),
expect_stanza("/message[@from='#coucou%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
......@@ -24,44 +22,46 @@ scenario = (
# it sends us the 2 items
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><max>2</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"/iq/disco_items:query/disco_items:item[@jid='#bar%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#coucou%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:first[text()='#bar%{irc_server_one}'][@index='0']",
"/iq/disco_items:query/rsm:set/rsm:last[text()='#coucou%{irc_server_one}']"),
"count(/iq/disco_items:query/disco_items:item[@jid])=2",
"/iq/disco_items:query/rsm:set/rsm:first[@index='0']",
"/iq/disco_items:query/rsm:set/rsm:last",
"!/iq/disco_items:query/rsm:set/rsm:count"),
# Ask for 12 (of 3) items. We get the whole list, and thus we have the count included.
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><max>12</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"/iq/disco_items:query/disco_items:item[@jid='#bar%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#coucou%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#foo%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:first[text()='#bar%{irc_server_one}'][@index='0']",
"/iq/disco_items:query/rsm:set/rsm:last[text()='#foo%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:count[text()='3']"),
"count(/iq/disco_items:query/disco_items:item[@jid])=3",
"/iq/disco_items:query/rsm:set/rsm:first[@index='0']",
"/iq/disco_items:query/rsm:set/rsm:last",
"/iq/disco_items:query/rsm:set/rsm:count[text()='3']",
after = save_value("first", lambda stanza: extract_text("/iq/disco_items:query/rsm:set/rsm:first", stanza))),
# Ask for 1 item, AFTER the first item (so,
# the second). Since we don’t invalidate the cache
# with this request, we should have the count
# included.
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>#bar%{irc_server_one}</after><max>1</max></set></query></iq>"),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>{first}</after><max>1</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"/iq/disco_items:query/disco_items:item[@jid='#coucou%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:first[text()='#coucou%{irc_server_one}'][@index='1']",
"/iq/disco_items:query/rsm:set/rsm:last[text()='#coucou%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:count[text()='3']"),
"count(/iq/disco_items:query/disco_items:item)=1",
"/iq/disco_items:query/rsm:set/rsm:first[@index='1']",
"/iq/disco_items:query/rsm:set/rsm:last",
"/iq/disco_items:query/rsm:set/rsm:count[text()='3']",
after = save_value("second", lambda stanza: extract_text("/iq/disco_items:query/rsm:set/rsm:first", stanza))),
# Ask for 1 item, AFTER the second item (so,
# the third).
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>#coucou%{irc_server_one}</after><max>1</max></set></query></iq>"),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>{second}</after><max>1</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"/iq/disco_items:query/disco_items:item[@jid='#foo%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:first[text()='#foo%{irc_server_one}'][@index='2']",
"/iq/disco_items:query/rsm:set/rsm:last[text()='#foo%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:count[text()='3']"),
"count(/iq/disco_items:query/disco_items:item)=1",
"/iq/disco_items:query/rsm:set/rsm:first[@index='2']",
"/iq/disco_items:query/rsm:set/rsm:last",
"/iq/disco_items:query/rsm:set/rsm:count[text()='3']",
after = save_value("third", lambda stanza: extract_text("/iq/disco_items:query/rsm:set/rsm:first", stanza))),
# Ask for 1 item, AFTER the third item (so,
# the fourth). Since it doesn't exist, we get 0 item
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>#foo%{irc_server_one}</after><max>1</max></set></query></iq>"),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>{third}</after><max>1</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"count(/iq/disco_items:query/disco_items:item)=0",
"/iq/disco_items:query/rsm:set/rsm:count[text()='3']"),
)
......@@ -46,7 +46,6 @@ scenario = (
# Do the exact same thing, from a different chan,
# to check if the response comes from the right JID
send_stanza("<presence from='{jid_one}/{resource_one}' to='#dummy%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#dummy%{irc_server_one}'][@type='groupchat']/subject"),
# Send a private message, to a in-room JID
......
......@@ -3,84 +3,71 @@ from scenarios import *
scenario = (
send_stanza("<presence from='{jid_one}/{resource_one}' to='#aaa%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#bbb%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#ccc%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#ddd%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#eee%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#fff%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#ggg%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#hhh%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#iii%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#jjj%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><max>3</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"/iq/disco_items:query/disco_items:item[@jid='#aaa%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#bbb%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#ccc%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:first[text()='#aaa%{irc_server_one}'][@index='0']",
"/iq/disco_items:query/rsm:set/rsm:last[text()='#ccc%{irc_server_one}']"),
"count(/iq/disco_items:query/disco_items:item[@jid])=3",
"/iq/disco_items:query/rsm:set/rsm:first[@index='0']",
"/iq/disco_items:query/rsm:set/rsm:last",
after = save_value("last", lambda stanza: extract_text("/iq/disco_items:query/rsm:set/rsm:last", stanza))),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>#ccc%{irc_server_one}</after><max>3</max></set></query></iq>"),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>{last}</after><max>3</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"/iq/disco_items:query/disco_items:item[@jid='#ddd%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#eee%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#fff%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:first[text()='#ddd%{irc_server_one}'][@index='3']",
"/iq/disco_items:query/rsm:set/rsm:last[text()='#fff%{irc_server_one}']"),
"count(/iq/disco_items:query/disco_items:item[@jid])=3",
"/iq/disco_items:query/rsm:set/rsm:first[@index='3']",
"/iq/disco_items:query/rsm:set/rsm:last",
after = save_value("last", lambda stanza: extract_text("/iq/disco_items:query/rsm:set/rsm:last", stanza))),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>#fff%{irc_server_one}</after><max>3</max></set></query></iq>"),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>{last}</after><max>3</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"/iq/disco_items:query/disco_items:item[@jid='#ggg%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#hhh%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#iii%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:first[text()='#ggg%{irc_server_one}'][@index='6']",
"/iq/disco_items:query/rsm:set/rsm:last[text()='#iii%{irc_server_one}']"),
"count(/iq/disco_items:query/disco_items:item[@jid])=3",
"/iq/disco_items:query/rsm:set/rsm:first[@index='6']",
"/iq/disco_items:query/rsm:set/rsm:last",
after = save_value("last", lambda stanza: extract_text("/iq/disco_items:query/rsm:set/rsm:last", stanza))),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>#iii%{irc_server_one}</after><max>3</max></set></query></iq>"),
send_stanza("<iq from='{jid_one}/{resource_one}' id='id' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'><set xmlns='http://jabber.org/protocol/rsm'><after>{last}</after><max>3</max></set></query></iq>"),
expect_stanza("/iq[@type='result']/disco_items:query",
"/iq/disco_items:query/disco_items:item[@jid='#jjj%{irc_server_one}']",
"/iq/disco_items:query/rsm:set/rsm:first[text()='#jjj%{irc_server_one}'][@index='9']",
"/iq/disco_items:query/rsm:set/rsm:last[text()='#jjj%{irc_server_one}']",
"count(/iq/disco_items:query/disco_items:item[@jid])=1",
"/iq/disco_items:query/rsm:set/rsm:first[@index='9']",
"/iq/disco_items:query/rsm:set/rsm:last",
"/iq/disco_items:query/rsm:set/rsm:count[text()='10']"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#aaa%{irc_server_one}/{nick_one}' type='unavailable' />"),
......
......@@ -34,19 +34,11 @@ scenario = (
(
send_stanza("<presence from='{jid_one}/{resource_one}' to='#{counter}%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence",
after = save_value("counter", counter)),
expect_stanza("/message"),
) * 110,
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='{irc_server_one}' type='get'><query xmlns='http://jabber.org/protocol/disco#items'/></iq>"),
# charybdis sends the list in alphabetic order, so #foo is the last, and #99 is after #120
expect_stanza("/iq/disco_items:query/disco_items:item[@jid='#0%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#1%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#109%{irc_server_one}']",
"/iq/disco_items:query/disco_items:item[@jid='#9%{irc_server_one}']",
"!/iq/disco_items:query/disco_items:item[@jid='#foo%{irc_server_one}']",
"!/iq/disco_items:query/disco_items:item[@jid='#99%{irc_server_one}']",
"!/iq/disco_items:query/disco_items:item[@jid='#90%{irc_server_one}']"),
expect_stanza("count(/iq/disco_items:query/disco_items:item[@jid])=100")
)
......@@ -16,7 +16,6 @@ scenario = (
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("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]",
......
......@@ -3,7 +3,6 @@ from scenarios import *
scenario = (
send_stanza("<presence from='{jid_one}/{resource_one}' to='#biboumi\\40louiz.org\\3a80%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #biboumi@louiz.org:80 [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#biboumi\\40louiz.org\\3a80%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#biboumi\\40louiz.org\\3a80%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
......
......@@ -6,9 +6,7 @@ scenario = (
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("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
simple_channel_join.expect_self_join_presence(),
send_stanza("<iq type='set' id='command2' 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(r"/iq/commands:command/commands:note[re:test(text(), 'Connected to IRC server irc.localhost on port 6667 since \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d \(\d+ seconds ago\)\.\n#foo from 1 resource: {resource_one}.*')]"),
......
......@@ -8,7 +8,6 @@ scenario = (
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo@{biboumi_host}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}', fixed_irc_server=True),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
......
......@@ -3,13 +3,11 @@ from scenarios import *
scenario = (
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("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<presence from='{jid_two}/{resource_two}' to='#bar%{irc_server_one}/{nick_two}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_two}/{resource_two}'),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
send_stanza("<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}'><x xmlns='http://jabber.org/protocol/muc#user'><invite to='{nick_two}'/></x></message>"),
......
......@@ -13,7 +13,6 @@ scenario = (
# We must receive the IRC server presence, in the connection sequence
sequences.connection("irc.localhost", '{jid_one}/{resource_one}', expected_irc_presence=True),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
......
......@@ -18,7 +18,6 @@ scenario = (
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_tls("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/my_special_nickname']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
......
......@@ -17,7 +17,6 @@ scenario = (
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("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
......@@ -42,7 +41,6 @@ scenario = (
# join some other channel, to stay connected to the server even after leaving #foo
send_stanza("<presence from='{jid_one}/{resource_one}' to='#DUMMY%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message/subject"),
......@@ -54,7 +52,6 @@ scenario = (
# Rejoin #foo, with some history limit
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}'><x xmlns='http://jabber.org/protocol/muc'><history maxchars='0'/></x></presence>"),
expect_stanza("/message"),
expect_stanza("/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message/subject"),
......@@ -65,7 +62,6 @@ scenario = (
# Rejoin #foo, with some history limit
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}'><x xmlns='http://jabber.org/protocol/muc'><history maxstanzas='3'/></x></presence>"),
expect_stanza("/message"),
expect_stanza("/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 2']"),
expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 3']"),
......@@ -77,7 +73,6 @@ scenario = (
# Rejoin #foo, with some history limit
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}'><x xmlns='http://jabber.org/protocol/muc'><history since='{first_timestamp}'/></x></presence>"),
expect_stanza("/message"),
expect_stanza("/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 3']"),
expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 4']"),
......@@ -87,7 +82,6 @@ scenario = (
# Rejoin #foo, with some history limit
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}'><x xmlns='http://jabber.org/protocol/muc'><history seconds='1'/></x></presence>"),
expect_stanza("/message"),
expect_stanza("/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 3']"),
expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 4']"),
......@@ -97,7 +91,6 @@ scenario = (
# Rejoin #foo, with some history limit
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}'><x xmlns='http://jabber.org/protocol/muc'><history seconds='5'/></x></presence>"),
expect_stanza("/message"),
expect_stanza("/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou']"), expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 2']"),
expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 3']"),
......
......@@ -3,14 +3,12 @@ from scenarios import *
scenario = (
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("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
simple_channel_join.expect_self_join_presence(),
send_stanza("<presence from='{jid_two}/{resource_two}' to='#foo%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection_begin("irc.localhost", '{jid_two}/{resource_two}'),
expect_stanza("/message[@to='{jid_two}/{resource_two}'][@type='chat']/body[text()='irc.localhost: {nick_one}: Nickname is already in use.']"),
expect_stanza("/message[@to='{jid_two}/{resource_two}'][@type='chat']/body[text()='irc.localhost: {nick_one}: Nickname is already in use']"),
expect_stanza("/presence[@type='error']/error[@type='cancel'][@code='409']/stanza:conflict"),
send_stanza("<presence from='{jid_two}/{resource_two}' to='#foo%{irc_server_one}/{nick_one}' type='unavailable' />")
)
......@@ -22,6 +22,16 @@ scenario = (
["/iq[@id='id1'][@type='result'][@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}']"],
),
# Remove +v manually. User ONLY has +o now. This doesn’t change the role/affiliation
send_stanza("<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>/mode -v {nick_two}</body></message>"),
expect_unordered(
["/message[@to='{jid_one}/{resource_one}']/body[text()='Mode #foo [-v {nick_two}] by {nick_one}']"],
["/message[@to='{jid_two}/{resource_one}']/body[text()='Mode #foo [-v {nick_two}] by {nick_one}']"],
["/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']"],
["/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']"],
),
# remove the mode
send_stanza("<iq from='{jid_one}/{resource_one}' id='id1' to='#foo%{irc_server_one}' type='set'><query xmlns='http://jabber.org/protocol/muc#admin'><item affiliation='member' nick='{nick_two}' role='participant'/></query></iq>"),
expect_unordered(
......
......@@ -16,7 +16,6 @@ scenario = (
# Join the channel, and re-do the same query
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("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
......
......@@ -7,16 +7,18 @@ scenario = (
send_stanza("<presence from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_two}/{resource_one}'),
expect_unordered(
["/presence/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']"],
["/presence/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']"],
["/presence/muc_user:x/muc_user:status[@code='110']"],
["/presence[@to='{jid_one}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']"],
["/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']"],
["/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",
"/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:status[@code='110']"],
["/message/subject"]
),
# Second resource
send_stanza("<presence from='{jid_two}/{resource_two}' to='#foo%{irc_server_one}/{nick_two}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/presence[@to='{jid_two}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_one}']"),
expect_stanza("/presence[@to='{jid_two}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_two}']",
"/presence/muc_user:x/muc_user:status[@code='110']"
expect_unordered(
["/presence[@to='{jid_two}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_one}']"],
["/presence[@to='{jid_two}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_two}']",
"/presence/muc_user:x/muc_user:status[@code='110']"]
),
expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat'][@to='{jid_two}/{resource_two}']/subject[not(text())]"),
......
......@@ -70,8 +70,8 @@ scenario = (
# First occupant (with the two resources) changes her/his nick to a conflicting one
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}' />"),
expect_unordered(
["/message[@to='{jid_one}/{resource_one}'][@type='chat']/body[text()='irc.localhost: Nick2: Nickname is already in use.']"],
["/message[@to='{jid_one}/{resource_two}'][@type='chat']/body[text()='irc.localhost: Nick2: Nickname is already in use.']"],
["/message[@to='{jid_one}/{resource_one}'][@type='chat']/body[text()='irc.localhost: Nick2: Nickname is already in use']"],
["/message[@to='{jid_one}/{resource_two}'][@type='chat']/body[text()='irc.localhost: Nick2: Nickname is already in use']"],
["/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}'][@type='error']"],
["/presence[@to='{jid_one}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_two}'][@type='error']"]
),
......
......@@ -8,7 +8,6 @@ scenario = (
expect_self_join_presence(jid = '{jid_one}/{resource_one}', chan = "#foo", nick = "{nick_one}"),
send_stanza("<presence from='{jid_one}/{resource_one}' to='#bar%{irc_server_one}/{nick_two}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message/body[text()='Mode #bar [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#bar%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']",
"/presence/muc_user:x/muc_user:status[@code='210']", # This status signals that the server forced our nick to NOT be the one we asked
......
......@@ -3,7 +3,6 @@ from scenarios import *
scenario = (
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("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
......
......@@ -5,7 +5,6 @@ conf = 'fixed_server'
scenario = (
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("irc.localhost", '{jid_one}/{resource_one}', fixed_irc_server=True),
expect_stanza("/message"),
expect_stanza("/presence"),
expect_stanza("/message"),
......
......@@ -4,7 +4,6 @@ scenario = (
# Join the channel
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("irc.localhost", '{jid_one}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat'][@to='{jid_one}/{resource_one}']/subject[not(text())]"),
......@@ -27,7 +26,6 @@ scenario = (
# Join some other channel with someone else
send_stanza("<presence from='{jid_two}/{resource_one}' to='#bar%{irc_server_one}/{nick_two}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_two}/{resource_one}'),
expect_stanza("/message/body[text()='Mode #bar [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_two}/{resource_one}'][@from='#bar%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#bar%{irc_server_one}'][@type='groupchat'][@to='{jid_two}/{resource_one}']/subject[not(text())]"),
......
from scenarios import *
def expect_self_join_presence(jid, chan, nick, irc_server="{irc_server_one}"):
def expect_self_join_presence(jid='{jid_one}/{resource_one}', chan='#foo', nick='{nick_one}', irc_server="{irc_server_one}"):
return (
expect_stanza("/message/body[text()='Mode " + chan + " [+nt] by irc.localhost']"),
expect_stanza("/presence[@to='" + jid +"'][@from='" + chan + "%" + irc_server + "/" + nick + "']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='100']", # Rooms are all non-anonymous
"/presence/muc_user:x/muc_user:status[@code='110']",
......
......@@ -5,7 +5,6 @@ conf = "fixed_server"
scenario = (
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo@{biboumi_host}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection("irc.localhost", '{jid_one}/{resource_one}', fixed_irc_server=True),
expect_stanza("/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo@{biboumi_host}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo@{biboumi_host}'][@type='groupchat']/subject[not(text())]"),
......
......@@ -5,7 +5,6 @@ scenario = (
# demonstrate bug https://lab.louiz.org/louiz/biboumi/issues/3291
# First user joins an other channel
send_stanza("<presence from='{jid_one}/{resource_one}' to='#bar%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
expect_stanza("/message"),
expect_stanza("/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@type='groupchat']/subject"),
......
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