tests: Split the connection sequence into two

We can now insert steps between the two parts
This commit is contained in:
louiz’
2016-04-22 15:02:28 +02:00
parent 38a59c38ff
commit 376b28172b
+13 -1
View File
@@ -287,7 +287,7 @@ def handshake_sequence():
partial(send_stanza, "<handshake xmlns='jabber:component:accept'/>"))
def connection_sequence(irc_host, jid):
def connection_begin_sequence(irc_host, jid):
jid = jid.format_map(common_replacements)
xpath = "/message[@to='" + jid + "'][@from='irc.localhost@biboumi.localhost']/body[text()='%s']"
xpath_re = "/message[@to='" + jid + "'][@from='irc.localhost@biboumi.localhost']/body[re:test(text(), '%s')]"
@@ -316,6 +316,14 @@ def connection_sequence(irc_host, jid):
xpath_re % (r'^%s: (\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* No Ident response)$' % irc_host)),
partial(expect_stanza,
xpath_re % (r'^%s: (\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* No Ident response)$' % irc_host)),
)
def connection_end_sequence(irc_host, jid):
jid = jid.format_map(common_replacements)
xpath = "/message[@to='" + jid + "'][@from='irc.localhost@biboumi.localhost']/body[text()='%s']"
xpath_re = "/message[@to='" + jid + "'][@from='irc.localhost@biboumi.localhost']/body[re:test(text(), '%s')]"
return (
partial(expect_stanza,
xpath_re % (r'^%s: Your host is .*$' % irc_host)),
partial(expect_stanza,
@@ -339,6 +347,10 @@ def connection_sequence(irc_host, jid):
)
def connection_sequence(irc_host, jid):
return connection_begin_sequence(irc_host, jid) + connection_end_sequence(irc_host, jid)
if __name__ == '__main__':
atexit.register(asyncio.get_event_loop().close)