summaryrefslogtreecommitdiff
path: root/tests/end_to_end
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-04-29 22:18:26 +0200
committerlouiz’ <louiz@louiz.org>2018-04-29 22:18:26 +0200
commitb0168fd45b3683c2d6f61ccae67dcd5b918a363d (patch)
tree6b3e035f6edfef0b9a8aac1813259b9c95ebcf35 /tests/end_to_end
parent0887be6eef24929fd594239e9569fc5cee54aba0 (diff)
downloadbiboumi-b0168fd45b3683c2d6f61ccae67dcd5b918a363d.tar.gz
biboumi-b0168fd45b3683c2d6f61ccae67dcd5b918a363d.tar.bz2
biboumi-b0168fd45b3683c2d6f61ccae67dcd5b918a363d.tar.xz
biboumi-b0168fd45b3683c2d6f61ccae67dcd5b918a363d.zip
mam: Send “fin complete” only when appropriate
Also simplify how we did the whole “limit + 1” And fix one bad interpretation of the XEP for the case where the query has no after or before restriction. fix #3349
Diffstat (limited to 'tests/end_to_end')
-rw-r--r--tests/end_to_end/__main__.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py
index 2f6fc28..1ec5a74 100644
--- a/tests/end_to_end/__main__.py
+++ b/tests/end_to_end/__main__.py
@@ -1961,7 +1961,7 @@ if __name__ == '__main__':
("/iq[@type='result'][@id='id3'][@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}']",
"/iq/mam:fin[@complete='true']/rsm:set")),
- # Retrieve a limited archive
+ # Retrieve the whole archive, but limit the response to one elemet
partial(send_stanza, "<iq to='#foo%{irc_server_one}' from='{jid_one}/{resource_one}' type='set' id='id4'><query xmlns='urn:xmpp:mam:2' queryid='qid4'><set xmlns='http://jabber.org/protocol/rsm'><max>1</max></set></query></iq>"),
partial(expect_stanza,
@@ -1971,7 +1971,7 @@ if __name__ == '__main__':
partial(expect_stanza,
("/iq[@type='result'][@id='id4'][@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}']",
- "/iq/mam:fin[@complete='true']/rsm:set")),
+ "!/iq/mam:fin[@complete='true']/rsm:set")),
]),
Scenario("mam_with_timestamps",
@@ -2205,11 +2205,9 @@ if __name__ == '__main__':
] * 150 + [
# Retrieve the archive, without any restriction
partial(send_stanza, "<iq to='#foo%{irc_server_one}' from='{jid_one}/{resource_one}' type='set' id='id1'><query xmlns='urn:xmpp:mam:2' queryid='qid1' /></iq>"),
- # Since we should only receive the last 100 messages from the archive,
- # it should start with message "1"
partial(expect_stanza,
("/message/mam:result[@queryid='qid1']/forward:forwarded/delay:delay",
- "/message/mam:result[@queryid='qid1']/forward:forwarded/client:message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/client:body[text()='1']")
+ "/message/mam:result[@queryid='qid1']/forward:forwarded/client:message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/client:body[text()='0']")
),
] + [
# followed by 98 more messages
@@ -2221,7 +2219,7 @@ if __name__ == '__main__':
# and finally the message "99"
partial(expect_stanza,
("/message/mam:result[@queryid='qid1']/forward:forwarded/delay:delay",
- "/message/mam:result[@queryid='qid1']/forward:forwarded/client:message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/client:body[text()='100']"),
+ "/message/mam:result[@queryid='qid1']/forward:forwarded/client:message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/client:body[text()='99']"),
after = partial(save_value, "last_uuid", partial(extract_attribute, "/message/mam:result", "id"))
),
# And it should not be marked as complete
@@ -2236,9 +2234,9 @@ if __name__ == '__main__':
partial(expect_stanza,
("/message/mam:result[@queryid='qid2']/forward:forwarded/delay:delay",
- "/message/mam:result[@queryid='qid2']/forward:forwarded/client:message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/client:body[text()='101']")
+ "/message/mam:result[@queryid='qid2']/forward:forwarded/client:message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/client:body[text()='100']")
),
- ] + 47 * [
+ ] + 48 * [
partial(expect_stanza,
("/message/mam:result[@queryid='qid2']/forward:forwarded/delay:delay",
"/message/mam:result[@queryid='qid2']/forward:forwarded/client:message[@from='#foo%{irc_server_one}/{nick_one}'][@type='groupchat']/client:body")
@@ -2297,8 +2295,7 @@ if __name__ == '__main__':
partial(expect_stanza,
("/iq[@type='result'][@id='id4'][@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}']",
"/iq/mam:fin/rsm:set/rsm:last[text()='{last_uuid}']",
- "/iq/mam:fin[@complete='true']",
- "/iq/mam:fin")),
+ "!/iq/mam:fin[@complete='true']",)),
]),
Scenario("channel_history_on_fixed_server",
[