[Telepathy-commits] [telepathy-gabble/master] add check_error_stanza

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Mon Mar 2 04:49:35 PST 2009


---
 tests/twisted/bytestream.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/twisted/bytestream.py b/tests/twisted/bytestream.py
index e68c56e..a5bc865 100644
--- a/tests/twisted/bytestream.py
+++ b/tests/twisted/bytestream.py
@@ -276,6 +276,11 @@ class BytestreamS5B(Bytestream):
     def wait_bytestream_closed(self):
         self.q.expect('s5b-connection-lost')
 
+    def check_error_stanza(self, iq):
+        error = xpath.queryForNodes('/iq/error', iq)
+        assert error['code'] == '404'
+        assert error['type'] == 'cancel'
+
 class BytestreamS5BPidgin(BytestreamS5B):
     """Simulate buggy S5B implementation (as Pidgin's one)"""
     def _send_connect_reply(self):
@@ -466,9 +471,7 @@ class BytestreamSIFallback(Bytestream):
             event = None
             iq_event = self.q.expect('stream-iq', iq_type='error', to=self.initiator)
 
-        error = xpath.queryForNodes('/iq/error', iq_event.stanza)[0]
-        assert error['code'] == '404'
-        assert error['type'] == 'cancel'
+        self.socks5.check_error_stanza(iq_event.stanza)
 
         # socks5 failed, let's try IBB
         self.ibb.open_bytestream()
-- 
1.5.6.5




More information about the telepathy-commits mailing list