summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-07-27 22:19:54 +0200
committerlouiz’ <louiz@louiz.org>2018-07-27 22:19:54 +0200
commit6c21edc1b8e0d6d45e5fb32224cb17cbd84a7250 (patch)
tree3db4ca306715e0b4bedd86691d56bd622a2d26ff
parent3782fc9ca46c0bd7436d1207e5a5ccd44d11df14 (diff)
downloadbiboumi-6c21edc1b8e0d6d45e5fb32224cb17cbd84a7250.tar.gz
biboumi-6c21edc1b8e0d6d45e5fb32224cb17cbd84a7250.tar.bz2
biboumi-6c21edc1b8e0d6d45e5fb32224cb17cbd84a7250.tar.xz
biboumi-6c21edc1b8e0d6d45e5fb32224cb17cbd84a7250.zip
Fix a few e2e tests that could fail due to race condition
The order of the messages received can be different, if the IRC server decides so, or lags, or something.
-rw-r--r--tests/end_to_end/__main__.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py
index ee754b0..6e254b0 100644
--- a/tests/end_to_end/__main__.py
+++ b/tests/end_to_end/__main__.py
@@ -1107,13 +1107,12 @@ if __name__ == '__main__':
("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']",),
("/presence[@to='{jid_one}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_two}']",),
("/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']",
- "/presence/muc_user:x/muc_user:status[@code='110']",),
+ "/presence/muc_user:x/muc_user:status[@code='110']",),
("/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']",),
+ ("/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]",),
]
),
- partial(expect_stanza, "/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
-
# That second user sends a private message to the first one
partial(send_stanza, "<message from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' type='chat'><body>RELLO</body></message>"),
# Message is received with a server-wide JID, by the two resources behind nick_one
@@ -1631,9 +1630,10 @@ if __name__ == '__main__':
"<presence from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}' />"),
connection_sequence("irc.localhost", '{jid_two}/{resource_one}'),
partial(expect_unordered, [
- ("/presence/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",),
- ("/presence/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",),
- ("/presence/muc_user:x/muc_user:status[@code='110']",),
+ ("/presence[@to='{jid_one}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",),
+ ("/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",
+ "/presence/muc_user:x/muc_user:status[@code='110']"),
+ ("/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",),
("/message/subject",),
]),
@@ -1649,9 +1649,10 @@ if __name__ == '__main__':
partial(send_stanza,
"<presence from='{jid_two}/{resource_one}' to='#bar%{irc_server_one}/{nick_two}' />"),
partial(expect_unordered, [
- ("/presence/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",),
- ("/presence/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",),
- ("/presence/muc_user:x/muc_user:status[@code='110']",),
+ ("/presence[@to='{jid_one}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",),
+ ("/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",
+ "/presence/muc_user:x/muc_user:status[@code='110']"),
+ ("/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",),
("/message/subject",),
]),
@@ -1766,7 +1767,7 @@ if __name__ == '__main__':
partial(expect_stanza, "/presence/muc_user:x/muc_user:status[@code='110']"),
partial(expect_stanza, "/message[@type='groupchat']/subject"),
- # Second user joins, fprom two resources
+ # Second user joins, from two resources
partial(send_stanza,
"<presence from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}' />"),
connection_sequence("irc.localhost", '{jid_two}/{resource_one}'),
@@ -1775,7 +1776,7 @@ if __name__ == '__main__':
("/presence/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",),
("/presence/muc_user:x/muc_user:status[@code='110']",),
("/message/subject",),
- ]),
+ ]),
partial(send_stanza,
"<presence from='{jid_two}/{resource_two}' to='#foo%{irc_server_one}/{nick_two}' />"),
@@ -2416,9 +2417,6 @@ if __name__ == '__main__':
# Second user joins
partial(send_stanza,
"<presence from='{jid_one}/{resource_two}' to='#foo@{biboumi_host}/{nick_one}' />"),
- # connection_sequence("irc.localhost", '{jid_one}/{resource_two}'),
- # partial(expect_stanza,
- # "/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
partial(expect_stanza,
("/presence[@to='{jid_one}/{resource_two}'][@from='#foo@{biboumi_host}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@jid='~nick@localhost'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']")