Handle the “after” RSM value to page through results

This commit is contained in:
louiz’
2018-02-10 19:51:59 +01:00
parent ce1b6583e8
commit 0280343ced
4 changed files with 75 additions and 3 deletions
+24
View File
@@ -2164,6 +2164,30 @@ if __name__ == '__main__':
"!/iq//mam:fin[@complete='true']",
"/iq//mam:fin")),
# Retrieve the next page, using the “after” thingy
partial(send_stanza, "<iq to='#foo%{irc_server_one}' from='{jid_one}/{resource_one}' type='set' id='id2'><query xmlns='urn:xmpp:mam:2' queryid='qid2' ><set xmlns='http://jabber.org/protocol/rsm'><after>{last_uuid}</after></set></query></iq>"),
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']")
),
] + 47 * [
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")
),
] + [
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()='149']"),
after = partial(save_value, "last_uuid", partial(extract_attribute, "/message/mam:result", "id"))
),
# And it should not be marked as complete
partial(expect_stanza,
("/iq[@type='result'][@id='id2'][@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")),
]),
Scenario("channel_history_on_fixed_server",
[