summaryrefslogtreecommitdiff
path: root/tests/end_to_end
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-11-02 21:25:26 +0100
committerlouiz’ <louiz@louiz.org>2016-11-02 21:25:26 +0100
commitc70301e503fdb887387a54fcf5284d593e65d837 (patch)
treec50b1b67454fa010dabb129f9b5de84e2b3f93b6 /tests/end_to_end
parentf50f50653dc064575e4730c31b5615301f00e057 (diff)
downloadbiboumi-c70301e503fdb887387a54fcf5284d593e65d837.tar.gz
biboumi-c70301e503fdb887387a54fcf5284d593e65d837.tar.bz2
biboumi-c70301e503fdb887387a54fcf5284d593e65d837.tar.xz
biboumi-c70301e503fdb887387a54fcf5284d593e65d837.zip
Fix the presences sent, when multiple resources join the virtual channel
fix #3216
Diffstat (limited to 'tests/end_to_end')
-rw-r--r--tests/end_to_end/__main__.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py
index e2a497d..26e7b05 100644
--- a/tests/end_to_end/__main__.py
+++ b/tests/end_to_end/__main__.py
@@ -1656,6 +1656,59 @@ if __name__ == '__main__':
partial(expect_stanza, "/message/body[text()='{nick_two} has been invited to #foo']"),
partial(expect_stanza, "/message[@to='{jid_two}/{resource_two}'][@from='#foo%{irc_server_one}']/muc_user:x/muc_user:invite[@from='#foo%{irc_server_one}/{nick_one}']"),
]),
+ Scenario("virtual_channel_multisession",
+ [
+ handshake_sequence(),
+ partial(send_stanza,
+ "<presence from='{jid_one}/{resource_one}' to='%{irc_server_one}/{nick_one}' />"),
+ connection_begin_sequence("irc.localhost", '{jid_one}/{resource_one}'),
+ partial(expect_stanza,
+ ("/presence[@to='{jid_one}/{resource_one}'][@from='%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",
+ "/presence/muc_user:x/muc_user:status[@code='110']")
+ ),
+ partial(expect_stanza, "/message[@from='%{irc_server_one}'][@type='groupchat']/subject[re:test(text(), '^This is a virtual channel.*$')]"),
+ connection_end_sequence("irc.localhost", '{jid_one}/{resource_one}'),
+
+ partial(send_stanza,
+ "<presence from='{jid_one}/{resource_two}' to='%{irc_server_one}/{nick_one}' />"),
+
+ partial(expect_stanza,
+ ("/presence[@to='{jid_one}/{resource_two}'][@from='%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",
+ "/presence/muc_user:x/muc_user:status[@code='110']")
+ ),
+ partial(expect_stanza, "/message[@to='{jid_one}/{resource_two}'][@from='%{irc_server_one}'][@type='groupchat']/subject[re:test(text(), '^This is a virtual channel.*$')]"),
+
+
+ partial(log_message, "Nick change"),
+ partial(send_stanza, "<presence from='{jid_one}/{resource_one}' to='%{irc_server_one}/{nick_two}' />"),
+
+ partial(expect_unordered, [
+ ("/presence[@from='%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_two}'][@type='unavailable']/muc_user:x/muc_user:item[@nick='Bobby']",
+ "/presence/muc_user:x/muc_user:status[@code='303']",
+ "/presence/muc_user:x/muc_user:status[@code='110']"),
+ ("/presence[@from='%{irc_server_one}/{nick_two}'][@to='{jid_one}/{resource_two}']",
+ "/presence/muc_user:x/muc_user:status[@code='110']"),
+
+ ("/presence[@from='%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='unavailable']/muc_user:x/muc_user:item[@nick='Bobby']",
+ "/presence/muc_user:x/muc_user:status[@code='303']",
+ "/presence/muc_user:x/muc_user:status[@code='110']"),
+ ("/presence[@from='%{irc_server_one}/{nick_two}'][@to='{jid_one}/{resource_one}']",
+ "/presence/muc_user:x/muc_user:status[@code='110']"),
+ ]),
+
+
+ partial(log_message, "First resource leaves."),
+ partial(send_stanza, "<presence type='unavailable' from='{jid_one}/{resource_one}' to='%{irc_server_one}/{nick_two}' />"),
+ partial(expect_stanza, ("/presence[@type='unavailable'][@from='%{irc_server_one}/{nick_two}'][@to='{jid_one}/{resource_one}']/muc_user:x/muc_user:status[@code='110']",
+ "/presence/status[text()='Biboumi note: 1 resources are still in this channel.']",)
+ ),
+
+ partial(log_message, "Second resource leaves."),
+ partial(send_stanza, "<presence type='unavailable' from='{jid_one}/{resource_two}' to='%{irc_server_one}/{nick_two}' />"),
+ partial(expect_stanza, "/presence[@type='unavailable'][@from='%{irc_server_one}/{nick_two}']"),
+ partial(expect_stanza, "/message[@from='{irc_server_one}']/body[text()='ERROR: Closing Link: localhost (Client Quit)']"),
+ partial(expect_stanza, "/message[@from='{irc_server_one}']/body[text()='ERROR: Connection closed.']"),
+ ]),
)
failures = 0