[Telepathy-commits] [telepathy-gabble/master] Test remote end sending a parameter update

Will Thompson will.thompson at collabora.co.uk
Thu Mar 5 04:24:04 PST 2009


---
 tests/twisted/jingle/jingletest2.py           |   10 ++++++++--
 tests/twisted/jingle/test-description-info.py |   13 +++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/tests/twisted/jingle/jingletest2.py b/tests/twisted/jingle/jingletest2.py
index 1a34634..528743f 100644
--- a/tests/twisted/jingle/jingletest2.py
+++ b/tests/twisted/jingle/jingletest2.py
@@ -67,12 +67,18 @@ class JingleProtocol:
                 ('error', None, { 'type': errtype, 'xmlns':
                     'urn:ietf:params:xml:ns:xmpp-stanzas' }, [ errchild ]) ])
 
-    def PayloadType(self, name, rate, id, **kw):
+    def PayloadType(self, name, rate, id, parameters={}, **kw):
         "Creates a <payload-type> element"
         kw['name'] = name
         kw['rate'] = rate
         kw['id'] = id
-        return ('payload-type', None, kw, [])
+        chrilden = [self.Parameter(name, value)
+                    for name, value in parameters.iteritems()]
+        return ('payload-type', None, kw, chrilden)
+
+    def Parameter(self, name, value):
+        "Creates a <parameter> element"
+        return ('parameter', None, {'name': name, 'value': value}, [])
 
     def TransportGoogleP2P(self):
         "Creates a <transport> element for Google P2P transport"
diff --git a/tests/twisted/jingle/test-description-info.py b/tests/twisted/jingle/test-description-info.py
index 638032a..7b4ebed 100644
--- a/tests/twisted/jingle/test-description-info.py
+++ b/tests/twisted/jingle/test-description-info.py
@@ -152,21 +152,26 @@ def test(q, bus, conn, stream):
     assert sorted(payload_types_tupled) == sorted(new_codecs[0:2]), \
         (payload_types_tupled, new_codecs[0:2])
 
-    # Instead, the remote end decides to change the clockrate of the third codec.
-    new_codecs = [ ('GSM', 3, 8000), ('PCMA', 8, 8000), ('PCMU', 0, 1600) ]
+    # Instead, the remote end decides to change the clockrate of and add a
+    # parameter to the third codec.
+    new_codecs = [ ('GSM', 3, 8000, {}),
+                   ('PCMA', 8, 8000, {}),
+                   ('PCMU', 0, 1600, {'choppy': 'false'}),
+                 ]
     # As per the XEP, it only sends the ones which have changed.
     c = new_codecs[2]
     node = jp.SetIq(jt2.peer, jt2.jid, [
         jp.Jingle(jt2.sid, jt2.peer, 'description-info', [
             jp.Content('stream1', 'initiator', 'both', [
                 jp.Description('audio', [
-                    jp.PayloadType(c[0], str(c[2]), str(c[1])) ]) ]) ]) ])
+                    jp.PayloadType(c[0], str(c[2]), str(c[1]), c[3])
+                ]) ]) ]) ])
     stream.send(jp.xml(node))
 
     # Gabble should patch its idea of the remote codecs with the update it just
     # got, and emit SetRemoteCodecs for them all.
     e = q.expect('dbus-signal', signal='SetRemoteCodecs')
-    new_codecs_dbus = unwrap(jt2.dbusify_codecs(new_codecs))
+    new_codecs_dbus = unwrap(jt2.dbusify_codecs_with_params(new_codecs))
     announced = unwrap(e.args[0])
     assert new_codecs_dbus == announced, (new_codecs_dbus, announced)
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list