From fcaffb9e778ad5962e69dc23c1fc91eb59a27945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 27 Aug 2017 22:30:44 +0200 Subject: Add support for the "history" node on MUC join Supports the "seconds", "maxstanzas", "since" and "maxchars" (but only =0) attributes. fix #3270 --- tests/end_to_end/__main__.py | 118 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) (limited to 'tests') diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index f590c1c..859904f 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -1942,6 +1942,124 @@ if __name__ == '__main__': partial(expect_stanza, "/iq[@type='result'][@id='id8'][@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}']"), ]), + + + Scenario("join_history_limits", + [ + handshake_sequence(), + partial(send_stanza, + ""), + connection_sequence("irc.localhost", '{jid_one}/{resource_one}'), + partial(expect_stanza, + "/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"), + partial(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']") + ), + partial(expect_stanza, "/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"), + + # Send two channel messages + partial(send_stanza, "coucou"), + partial(expect_stanza, + ("/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='coucou']", + "/message/stable_id:stanza-id[@by='#foo%{irc_server_one}'][@id]",) + ), + + partial(send_stanza, "coucou 2"), + # Record the current time + partial(expect_stanza, "/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='coucou 2']", + after = partial(save_current_timestamp_plus_delta, "first_timestamp", datetime.timedelta(seconds=1))), + + # Wait two seconds before sending two new messages + partial(sleep_for, 2), + partial(send_stanza, "coucou 3"), + partial(send_stanza, "coucou 4"), + partial(expect_stanza, "/message[@type='groupchat']/body[text()='coucou 3']"), + partial(expect_stanza, "/message[@type='groupchat']/body[text()='coucou 4']", + after = partial(save_current_timestamp_plus_delta, "second_timestamp", datetime.timedelta(seconds=1))), + + # join the virtual channel, to stay connected to the server even after leaving #foo + partial(send_stanza, + ""), + partial(expect_stanza, "/presence/muc_user:x/muc_user:status[@code='110']"), + partial(expect_stanza, "/message/subject"), + + # Leave #foo + partial(send_stanza, ""), + partial(expect_stanza, "/presence[@type='unavailable']"), + + # Rejoin #foo, with some history limit + partial(send_stanza, + ""), + partial(expect_stanza, "/message"), + partial(expect_stanza, "/presence/muc_user:x/muc_user:status[@code='110']"), + partial(expect_stanza, "/message/subject"), + + partial(send_stanza, ""), + partial(expect_stanza, "/presence[@type='unavailable']"), + + # Rejoin #foo, with some history limit + partial(send_stanza, + ""), + partial(expect_stanza, "/message"), + partial(expect_stanza, "/presence/muc_user:x/muc_user:status[@code='110']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 2']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 3']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 4']"), + partial(expect_stanza, "/message/subject"), + + partial(send_stanza, ""), + partial(expect_stanza, "/presence[@type='unavailable']"), + + + # Rejoin #foo, with some history limit + partial(send_stanza, + ""), + partial(expect_stanza, "/message"), + partial(expect_stanza, "/presence/muc_user:x/muc_user:status[@code='110']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 3']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 4']"), + partial(expect_stanza, "/message/subject"), + partial(send_stanza, ""), + partial(expect_stanza, "/presence[@type='unavailable']"), + + # Rejoin #foo, with some history limit + partial(send_stanza, + ""), + partial(expect_stanza, "/message"), + partial(expect_stanza, "/presence/muc_user:x/muc_user:status[@code='110']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 3']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 4']"), + partial(expect_stanza, "/message/subject"), + partial(send_stanza, ""), + partial(expect_stanza, "/presence[@type='unavailable']"), + + # Rejoin #foo, with some history limit + partial(send_stanza, + ""), + partial(expect_stanza, "/message"), + partial(expect_stanza, "/presence/muc_user:x/muc_user:status[@code='110']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou']"), partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 2']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 3']"), + partial(expect_stanza, + "/message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/body[text()='coucou 4']"), + partial(expect_stanza, "/message/subject"), + partial(send_stanza, ""), + partial(expect_stanza, "/presence[@type='unavailable']"), + + ]), + + Scenario("mam_on_fixed_server", [ handshake_sequence(), -- cgit v1.2.3