[telepathy-gabble/master] Test calls rejected as busy are exposed as such

Will Thompson will.thompson at collabora.co.uk
Thu Mar 26 08:46:07 PDT 2009


---
 tests/twisted/jingle/jingletest2.py                |    8 +++++++-
 .../twisted/jingle/test-outgoing-call-rejected.py  |   13 ++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tests/twisted/jingle/jingletest2.py b/tests/twisted/jingle/jingletest2.py
index f82aa68..27cce16 100644
--- a/tests/twisted/jingle/jingletest2.py
+++ b/tests/twisted/jingle/jingletest2.py
@@ -109,6 +109,9 @@ class JingleProtocol:
     def extract_session_id(self, query):
         return query['sid']
 
+    def supports_termination_reason(self):
+        return False
+
 class GtalkProtocol03(JingleProtocol):
     features = [ 'http://www.google.com/xmpp/protocol/voice/v1' ]
 
@@ -246,6 +249,9 @@ class JingleProtocol031(JingleProtocol):
         return ('description', 'urn:xmpp:jingle:apps:rtp:0',
             { 'media': type }, children)
 
+    def supports_termination_reason(self):
+        return True
+
 
 class JingleTest2:
     # Default caps for the remote end
@@ -325,7 +331,7 @@ class JingleTest2:
     def terminate(self, reason=None):
         jp = self.jp
 
-        if reason is not None and jp.dialect == 'jingle-v0.31':
+        if reason is not None and jp.supports_termination_reason():
             body = [("reason", None, {}, [(reason, None, {}, [])])]
         else:
             body = []
diff --git a/tests/twisted/jingle/test-outgoing-call-rejected.py b/tests/twisted/jingle/test-outgoing-call-rejected.py
index e7c0ab2..75c9a0c 100644
--- a/tests/twisted/jingle/test-outgoing-call-rejected.py
+++ b/tests/twisted/jingle/test-outgoing-call-rejected.py
@@ -49,7 +49,18 @@ def test(jp, q, bus, conn, stream):
     jt.set_sid_from_initiate(e.query)
     jt.terminate(reason="busy")
 
-    e = q.expect('dbus-signal', signal='Close') #XXX - match against the path
+    mc = q.expect('dbus-signal', signal='MembersChanged')
+    _, added, removed, lp, rp, actor, reason = mc.args
+    assert added == [], added
+    assert set(removed) == set([self_handle, remote_handle]), \
+        (removed, self_handle, remote_handle)
+    assert lp == [], lp
+    assert rp == [], rp
+    assert actor == remote_handle, (actor, remote_handle)
+    if jp.supports_termination_reason():
+        assert reason == cs.GC_REASON_BUSY, reason
+
+    q.expect('dbus-signal', signal='Close') #XXX - match against the path
 
     conn.Disconnect()
     q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
-- 
1.5.6.5




More information about the telepathy-commits mailing list