diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2013-04-11 19:33:29 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2013-06-11 17:01:07 +0100 |
commit | 54d037ab9b532e70a7fa80ad69a18bed58ccb480 (patch) | |
tree | 5a18d8c030a17229c626111536d4a7dd2943fad9 | |
parent | 4b23e0ec83024ebbfcaaeb12cdcd086f7a640b9f (diff) | |
download | telepathy-gabble-54d037ab9b532e70a7fa80ad69a18bed58ccb480.tar.gz |
gabbletest: add hooks for hazetest
I need these so that hazetest can just override what it needs, rather
than actually modifying the copy of gabbletest.
https://bugs.freedesktop.org/show_bug.cgi?id=65658
-rw-r--r-- | tests/twisted/gabbletest.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/twisted/gabbletest.py b/tests/twisted/gabbletest.py index 0985cd422..e6b8baa0e 100644 --- a/tests/twisted/gabbletest.py +++ b/tests/twisted/gabbletest.py @@ -563,9 +563,20 @@ def element_repr(element): """ return element.toXml().encode('unicode-escape') +def expect_connected(queue): + queue.expect('dbus-signal', signal='StatusChanged', + args=[cs.CONN_STATUS_CONNECTING, cs.CSR_REQUESTED]) + queue.expect('stream-authenticated') + queue.expect('dbus-signal', signal='PresencesChanged', + args=[{1L: (cs.PRESENCE_AVAILABLE, u'available', '')}]) + queue.expect('dbus-signal', signal='StatusChanged', + args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) + def exec_test_deferred(fun, params, protocol=None, timeout=None, authenticator=None, num_instances=1, - do_connect=True): + do_connect=True, + make_connection_func=make_connection, + expect_connected_func=expect_connected): # hack to ease debugging domish.Element.__repr__ = element_repr colourer = None @@ -595,7 +606,7 @@ def exec_test_deferred(fun, params, protocol=None, timeout=None, suffix = str(i) try: - (conn, jid) = make_connection(bus, queue.append, params, suffix) + (conn, jid) = make_connection_func(bus, queue.append, params, suffix) except Exception, e: # Crap. This is normally because the connection's still kicking # around on the bus. Let's bin any connections we *did* manage to @@ -649,13 +660,7 @@ def exec_test_deferred(fun, params, protocol=None, timeout=None, if do_connect: for conn in conns: conn.Connect() - queue.expect('dbus-signal', signal='StatusChanged', - args=[cs.CONN_STATUS_CONNECTING, cs.CSR_REQUESTED]) - queue.expect('stream-authenticated') - queue.expect('dbus-signal', signal='PresencesChanged', - args=[{1L: (cs.PRESENCE_AVAILABLE, u'available', '')}]) - queue.expect('dbus-signal', signal='StatusChanged', - args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) + expect_connected_func(queue) if len(conns) == 1: fun(queue, bus, conns[0], streams[0]) |