summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-02-10 19:24:12 +0100
committerlouiz’ <louiz@louiz.org>2018-02-10 19:24:12 +0100
commitce1b6583e82cc03130700222e64796bacd704463 (patch)
tree7ec14792c7e5cee3059103c25c95fc2156a40de6
parent99389eefba1883753c15c6f411fb8543c93f58a1 (diff)
downloadbiboumi-ce1b6583e82cc03130700222e64796bacd704463.tar.gz
biboumi-ce1b6583e82cc03130700222e64796bacd704463.tar.bz2
biboumi-ce1b6583e82cc03130700222e64796bacd704463.tar.xz
biboumi-ce1b6583e82cc03130700222e64796bacd704463.zip
e2e test that the last uuid is the same as the “last” value in the iq result
-rw-r--r--tests/end_to_end/__main__.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py
index 5a53c36..7fa779e 100644
--- a/tests/end_to_end/__main__.py
+++ b/tests/end_to_end/__main__.py
@@ -270,11 +270,13 @@ def send_stanza(stanza, xmpp, biboumi):
def expect_stanza(xpaths, xmpp, biboumi, optional=False, after=None):
+ replacements = common_replacements
+ replacements.update(xmpp.saved_values)
check_func = check_xpath if not optional else check_xpath_optional
if isinstance(xpaths, str):
- xmpp.stanza_checker = partial(check_func, [xpaths.format_map(common_replacements)], xmpp, after)
+ xmpp.stanza_checker = partial(check_func, [xpaths.format_map(replacements)], xmpp, after)
elif isinstance(xpaths, tuple):
- xmpp.stanza_checker = partial(check_func, [xpath.format_map(common_replacements) for xpath in xpaths], xmpp, after)
+ xmpp.stanza_checker = partial(check_func, [xpath.format_map(replacements) for xpath in xpaths], xmpp, after)
else:
print("Warning, from argument type passed to expect_stanza: %s" % (type(xpaths)))
@@ -2080,8 +2082,6 @@ if __name__ == '__main__':
partial(expect_stanza, "/presence[@type='unavailable']"),
]),
-
-
Scenario("mam_on_fixed_server",
[
handshake_sequence(),
@@ -2154,11 +2154,13 @@ 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()='100']"),
+ 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='id1'][@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")),