[Telepathy-commits] [telepathy-gabble/master] factor out expect_socks5_reply
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Thu Feb 19 03:12:13 PST 2009
---
...offer-accept-private-dbus-stream-tube-socks5.py | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/tests/twisted/tubes/offer-accept-private-dbus-stream-tube-socks5.py b/tests/twisted/tubes/offer-accept-private-dbus-stream-tube-socks5.py
index 787b265..1e70f0a 100644
--- a/tests/twisted/tubes/offer-accept-private-dbus-stream-tube-socks5.py
+++ b/tests/twisted/tubes/offer-accept-private-dbus-stream-tube-socks5.py
@@ -121,6 +121,14 @@ def send_socks5_init(stream, from_, to, sid, mode, hosts):
streamhost['port'] = port
stream.send(iq)
+def expect_socks5_reply(q):
+ event = q.expect('stream-iq', iq_type='result')
+ iq = event.stanza
+ query = xpath.queryForNodes('/iq/query', iq)[0]
+ assert query.uri == ns.BYTESTREAMS
+ streamhost_used = xpath.queryForNodes('/query/streamhost-used', query)[0]
+ return streamhost_used
+
def test(q, bus, conn, stream):
t.set_up_echo("")
t.set_up_echo("2")
@@ -446,11 +454,7 @@ def test(q, bus, conn, stream):
transport = socks5_expect_connection(q, 'alpha', bob_full_jid, self_full_jid)
- event = q.expect('stream-iq', iq_type='result')
- iq = event.stanza
- query = xpath.queryForNodes('/iq/query', iq)[0]
- assert query.uri == ns.BYTESTREAMS
- streamhost_used = xpath.queryForNodes('/query/streamhost-used', query)[0]
+ streamhost_used = expect_socks5_reply(q)
assert streamhost_used['jid'] == bob_full_jid
transport.write("HELLO WORLD")
@@ -473,11 +477,7 @@ def test(q, bus, conn, stream):
transport = socks5_expect_connection(q, 'beta', bob_full_jid, self_full_jid)
- event = q.expect('stream-iq', iq_type='result')
- iq = event.stanza
- query = xpath.queryForNodes('/iq/query', iq)[0]
- assert query.uri == ns.BYTESTREAMS
- streamhost_used = xpath.queryForNodes('/query/streamhost-used', query)[0]
+ streamhost_used = expect_socks5_reply(q)
assert streamhost_used['jid'] == bob_full_jid
transport.write("HELLO, NEW WORLD")
--
1.5.6.5
More information about the telepathy-commits
mailing list