summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-06-24 11:43:13 +0200
committerlouiz’ <louiz@louiz.org>2016-06-24 11:43:13 +0200
commit2fe8878169b094a12d74d69ea97314d172647ea8 (patch)
tree80cc881a035d19f1d669ad541ce0a27be4b5b42f /tests
parent7ae29890c3fd498d8d4fecd64cfc0da703b77a1a (diff)
downloadbiboumi-2fe8878169b094a12d74d69ea97314d172647ea8.tar.gz
biboumi-2fe8878169b094a12d74d69ea97314d172647ea8.tar.bz2
biboumi-2fe8878169b094a12d74d69ea97314d172647ea8.tar.xz
biboumi-2fe8878169b094a12d74d69ea97314d172647ea8.zip
Add a e2e test that checks self-ping with multiple resources behind one nick
Diffstat (limited to 'tests')
-rw-r--r--tests/end_to_end/__main__.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py
index ebd2a73..06aa1ce 100644
--- a/tests/end_to_end/__main__.py
+++ b/tests/end_to_end/__main__.py
@@ -726,6 +726,40 @@ if __name__ == '__main__':
"<iq type='result' to='{lower_nick_one}!{irc_server_one}' id='gnip_tsrif' from='{jid_one}/{resource_one}'/>"),
partial(expect_stanza,
"/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='first_ping']"),
+
+ # Now join the same room, from the same bare JID, behind the same nick
+ partial(send_stanza,
+ "<presence from='{jid_one}/{resource_two}' to='#foo%{irc_server_one}/{nick_one}' />"),
+ partial(expect_stanza,
+ ("/presence[@to='{jid_one}/{resource_two}'][@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'][@to='{jid_one}/{resource_two}']/subject[not(text())]"),
+
+ # And re-send a self ping
+ partial(send_stanza,
+ "<iq type='get' from='{jid_one}/{resource_one}' id='second_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"),
+ # We receive our own ping request. Note that we don't know the to value, it could be one of our two resources.
+ partial(expect_stanza,
+ "/iq[@from='{lower_nick_one}!{irc_server_one}'][@type='get'][@to][@id='gnip_dnoces']",
+ after = partial(save_value, "to", partial(extract_attribute, "/iq", "to"))),
+ # Respond to the request, using the extracted 'to' value as our 'from'
+ partial(send_stanza,
+ "<iq type='result' to='{lower_nick_one}!{irc_server_one}' id='gnip_dnoces' from='{to}'/>"),
+ partial(expect_stanza,
+ "/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='second_ping']"),
+
+ ## And re-do exactly the same thing, just change the resource initiating the self ping
+ partial(send_stanza,
+ "<iq type='get' from='{jid_one}/{resource_two}' id='third_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"),
+ partial(expect_stanza,
+ "/iq[@from='{lower_nick_one}!{irc_server_one}'][@type='get'][@to][@id='gnip_driht']",
+ after = partial(save_value, "to", partial(extract_attribute, "/iq", "to"))),
+ partial(send_stanza,
+ "<iq type='result' to='{lower_nick_one}!{irc_server_one}' id='gnip_driht' from='{to}'/>"),
+ partial(expect_stanza,
+ "/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_two}'][@id='third_ping']"),
+
]),
)