From 42677ae46cb0daf644ab7cb69831e2e34c791b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Thu, 20 Apr 2017 18:06:53 +0200 Subject: =?UTF-8?q?Fix=20the=20tests=20to=20take=20into=20account=20the=20?= =?UTF-8?q?new=20=E2=80=9Cyour=20are=20exempt=20bla=E2=80=9D=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/end_to_end/__main__.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index 8be5078..240c979 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -423,7 +423,6 @@ def connection_begin_sequence(irc_host, jid): xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % 'irc.localhost')), partial(expect_stanza, xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % 'irc.localhost')), - partial(expect_stanza, xpath_re % (r'^%s: \*\*\* You are exempt from flood limits$' % 'irc.localhost')), ) def connection_tls_begin_sequence(irc_host, jid): @@ -447,7 +446,6 @@ def connection_tls_begin_sequence(irc_host, jid): xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % irc_host)), partial(expect_stanza, xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % irc_host)), - partial(expect_stanza, xpath_re % (r'^%s: \*\*\* You are exempt from flood limits$' % 'irc.localhost')), ) def connection_end_sequence(irc_host, jid): @@ -480,12 +478,23 @@ def connection_end_sequence(irc_host, jid): xpath_re % r'^User mode for \w+ is \[\+Z?i\]$'), ) +def connection_middle_sequence(irc_host, jid): + xpath_re = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[re:test(text(), '%s')]" + irc_host = 'irc.localhost' + return ( + partial(expect_stanza, xpath_re % (r'^%s: \*\*\* You are exempt from flood limits$' % irc_host)), + ) + def connection_sequence(irc_host, jid): - return connection_begin_sequence(irc_host, jid) + connection_end_sequence(irc_host, jid) + return connection_begin_sequence(irc_host, jid) +\ + connection_middle_sequence(irc_host, jid) +\ + connection_end_sequence(irc_host, jid) def connection_tls_sequence(irc_host, jid): - return connection_tls_begin_sequence(irc_host, jid) + connection_end_sequence(irc_host, jid) + return connection_tls_begin_sequence(irc_host, jid) + \ + connection_middle_sequence(irc_host, jid) +\ + connection_end_sequence(irc_host, jid) def extract_attribute(xpath, name, stanza): @@ -554,6 +563,8 @@ if __name__ == '__main__': partial(send_stanza, ""), connection_begin_sequence("irc.localhost", '{jid_one}/{resource_one}'), + connection_middle_sequence("irc.localhost", '{jid_one}/{resource_one}'), + partial(expect_stanza, ("/presence[@to='{jid_one}/{resource_one}'][@from='%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']", "/presence/muc_user:x/muc_user:status[@code='110']") @@ -587,6 +598,8 @@ if __name__ == '__main__': partial(send_stanza, ""), connection_begin_sequence("irc.localhost", '{jid_one}/{resource_one}'), + connection_middle_sequence("irc.localhost", '{jid_one}/{resource_one}'), + partial(expect_stanza, ("/presence[@to='{jid_one}/{resource_one}'][@from='%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']", "/presence/muc_user:x/muc_user:status[@code='110']") @@ -2136,6 +2149,8 @@ if __name__ == '__main__': partial(send_stanza, ""), connection_begin_sequence("irc.localhost", '{jid_one}/{resource_one}'), + connection_middle_sequence("irc.localhost", '{jid_one}/{resource_one}'), + partial(expect_stanza, ("/presence[@to='{jid_one}/{resource_one}'][@from='%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']", "/presence/muc_user:x/muc_user:status[@code='110']") @@ -2469,6 +2484,7 @@ if __name__ == '__main__': partial(send_stanza, ""), connection_begin_sequence("irc.localhost", '{jid_two}/{resource_two}'), + partial(expect_stanza, "/message[@to='{jid_two}/{resource_two}'][@type='chat']/body[text()='irc.localhost: {nick_one}: Nickname is already in use.']"), partial(expect_stanza, "/presence[@type='error']/error[@type='cancel'][@code='409']/stanza:conflict"), partial(send_stanza, "") -- cgit v1.2.3