[telepathy-gabble/master] Jingle tests: get the peer's full and bare JIDs from the JingleTest(2) object

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jan 5 10:56:47 PST 2010


---
 tests/twisted/jingle/accept-extra-stream.py   |    6 +++---
 tests/twisted/jingle/incoming-basics.py       |   20 ++++++++++----------
 tests/twisted/jingle/outgoing-basics.py       |    6 +++---
 tests/twisted/jingle/outgoing-ensure.py       |    2 +-
 tests/twisted/jingle/outgoing-many-streams.py |    6 +++---
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/tests/twisted/jingle/accept-extra-stream.py b/tests/twisted/jingle/accept-extra-stream.py
index a32ff66..957b7b1 100644
--- a/tests/twisted/jingle/accept-extra-stream.py
+++ b/tests/twisted/jingle/accept-extra-stream.py
@@ -18,7 +18,7 @@ def test(q, bus, conn, stream):
     jt2.prepare()
 
     self_handle = conn.GetSelfHandle()
-    remote_handle = conn.RequestHandles(cs.HT_CONTACT, [remote_jid])[0]
+    remote_handle = conn.RequestHandles(cs.HT_CONTACT, [jt2.peer])[0]
 
     # Remote end calls us
     node = jp.SetIq(jt2.peer, jt2.jid, [
@@ -74,7 +74,7 @@ def test(q, bus, conn, stream):
 
     # peer gets the transport
     e = q.expect('stream-iq', predicate=jp.action_predicate('transport-info'))
-    assertEquals(remote_jid, e.query['initiator'])
+    assertEquals(jt2.peer, e.query['initiator'])
 
     stream.send(make_result_iq(stream, e.stanza))
 
@@ -149,7 +149,7 @@ def test(q, bus, conn, stream):
         # It's not entirely clear that this *needs* to fire here...
         EventPattern('dbus-signal', signal='SetStreamSending', args=[False]),
         )
-    assertEquals(remote_jid, ti.query['initiator'])
+    assertEquals(jt2.peer, ti.query['initiator'])
 
     stream.send(make_result_iq(stream, e.stanza))
 
diff --git a/tests/twisted/jingle/incoming-basics.py b/tests/twisted/jingle/incoming-basics.py
index 6fe0c0a..ba95f6d 100644
--- a/tests/twisted/jingle/incoming-basics.py
+++ b/tests/twisted/jingle/incoming-basics.py
@@ -17,7 +17,7 @@ def test(jp, q, bus, conn, stream):
     jt.prepare()
 
     self_handle = conn.GetSelfHandle()
-    remote_handle = conn.RequestHandles(cs.HT_CONTACT, ["foo at bar.com/Foo"])[0]
+    remote_handle = conn.RequestHandles(cs.HT_CONTACT, [jt.peer])[0]
 
     # Remote end calls us
     jt.incoming_call()
@@ -79,14 +79,14 @@ def test(jp, q, bus, conn, stream):
     # Exercise channel properties
     channel_props = media_chan.GetAll(
         cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
-    assert channel_props['TargetHandle'] == remote_handle
-    assert channel_props['TargetHandleType'] == cs.HT_CONTACT
-    assert media_chan.GetHandle(dbus_interface=cs.CHANNEL) == (cs.HT_CONTACT,
-            remote_handle)
-    assert channel_props['TargetID'] == 'foo at bar.com'
-    assert channel_props['InitiatorID'] == 'foo at bar.com'
-    assert channel_props['InitiatorHandle'] == remote_handle
-    assert channel_props['Requested'] == False
+    assertEquals(remote_handle, channel_props['TargetHandle'])
+    assertEquals(cs.HT_CONTACT, channel_props['TargetHandleType'])
+    assertEquals((cs.HT_CONTACT, remote_handle),
+            media_chan.GetHandle(dbus_interface=cs.CHANNEL))
+    assertEquals(jt.peer_bare_jid, channel_props['TargetID'])
+    assertEquals(jt.peer_bare_jid, channel_props['InitiatorID'])
+    assertEquals(remote_handle, channel_props['InitiatorHandle'])
+    assertEquals(False, channel_props['Requested'])
 
     group_props = media_chan.GetAll(
         cs.CHANNEL_IFACE_GROUP, dbus_interface=dbus.PROPERTIES_IFACE)
@@ -134,7 +134,7 @@ def test(jp, q, bus, conn, stream):
 
     # peer gets the transport
     e = q.expect('stream-iq', predicate=jp.action_predicate('transport-info'))
-    assertEquals('foo at bar.com/Foo', e.query['initiator'])
+    assertEquals(jt.peer, e.query['initiator'])
 
     if jp.dialect in ['jingle-v0.15', 'jingle-v0.31']:
         content = xpath.queryForNodes('/iq/jingle/content', e.stanza)[0]
diff --git a/tests/twisted/jingle/outgoing-basics.py b/tests/twisted/jingle/outgoing-basics.py
index 55944fe..fefd3f6 100644
--- a/tests/twisted/jingle/outgoing-basics.py
+++ b/tests/twisted/jingle/outgoing-basics.py
@@ -43,7 +43,7 @@ def worker(jp, q, bus, conn, stream, variant):
     jt2.prepare()
 
     self_handle = conn.GetSelfHandle()
-    remote_handle = conn.RequestHandles(1, ["foo at bar.com/Foo"])[0]
+    remote_handle = conn.RequestHandles(1, [jt2.peer])[0]
 
     if variant == REQUEST_NONYMOUS:
         path = conn.RequestChannel(cs.CHANNEL_TYPE_STREAMED_MEDIA,
@@ -81,7 +81,7 @@ def worker(jp, q, bus, conn, stream, variant):
     if variant == REQUEST_NONYMOUS or variant == CREATE:
         assertEquals(remote_handle, emitted_props[cs.TARGET_HANDLE])
         assertEquals(cs.HT_CONTACT, emitted_props[cs.TARGET_HANDLE_TYPE])
-        assertEquals('foo at bar.com', emitted_props[cs.TARGET_ID])
+        assertEquals(jt2.peer_bare_jid, emitted_props[cs.TARGET_ID])
     else:
         assertEquals(0, emitted_props[cs.TARGET_HANDLE])
         assertEquals(cs.HT_NONE, emitted_props[cs.TARGET_HANDLE_TYPE])
@@ -103,7 +103,7 @@ def worker(jp, q, bus, conn, stream, variant):
     if variant == REQUEST_NONYMOUS or variant == CREATE:
         assertEquals(remote_handle, channel_props['TargetHandle'])
         assertEquals(cs.HT_CONTACT, channel_props['TargetHandleType'])
-        assertEquals('foo at bar.com', channel_props['TargetID'])
+        assertEquals(jt2.peer_bare_jid, channel_props['TargetID'])
         assertEquals((cs.HT_CONTACT, remote_handle), chan.GetHandle())
     else:
         assertEquals(0, channel_props['TargetHandle'])
diff --git a/tests/twisted/jingle/outgoing-ensure.py b/tests/twisted/jingle/outgoing-ensure.py
index ca5360a..a3a4335 100644
--- a/tests/twisted/jingle/outgoing-ensure.py
+++ b/tests/twisted/jingle/outgoing-ensure.py
@@ -57,7 +57,7 @@ def test(q, bus, conn, stream):
     assertEquals(cs.CHANNEL_TYPE_STREAMED_MEDIA, emitted_props[cs.CHANNEL_TYPE])
     assertEquals(cs.HT_CONTACT, emitted_props[cs.TARGET_HANDLE_TYPE])
     assertEquals(handle, emitted_props[cs.TARGET_HANDLE])
-    assertEquals('foo at bar.com', emitted_props[cs.TARGET_ID])
+    assertEquals(jt.peer_bare_jid, emitted_props[cs.TARGET_ID])
     assert emitted_props[cs.REQUESTED]
     assertEquals(self_handle, emitted_props[cs.INITIATOR_HANDLE])
     assertEquals('test at localhost', emitted_props[cs.INITIATOR_ID])
diff --git a/tests/twisted/jingle/outgoing-many-streams.py b/tests/twisted/jingle/outgoing-many-streams.py
index da9745c..b855b09 100644
--- a/tests/twisted/jingle/outgoing-many-streams.py
+++ b/tests/twisted/jingle/outgoing-many-streams.py
@@ -39,7 +39,7 @@ def test(q, bus, conn, stream):
 
     # Gabble doesn't trust it, so makes a disco
     event = q.expect('stream-iq', query_ns='http://jabber.org/protocol/disco#info',
-             to='foo at bar.com/Foo')
+             to=jt.remote_jid)
 
     jt.send_remote_disco_reply(event.stanza)
 
@@ -79,7 +79,7 @@ def test(q, bus, conn, stream):
     assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAMED_MEDIA
     assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
     assert emitted_props[cs.TARGET_HANDLE] == handle
-    assert emitted_props[cs.TARGET_ID] == 'foo at bar.com', emitted_props
+    assert emitted_props[cs.TARGET_ID] == jt.remote_bare_jid, emitted_props
     assert emitted_props[cs.REQUESTED] == True
     assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
     assert emitted_props[cs.INITIATOR_ID]  == 'test at localhost'
@@ -105,7 +105,7 @@ def test(q, bus, conn, stream):
               cs.TP_AWKWARD_PROPERTIES, cs.CHANNEL_IFACE_HOLD]:
         assert i in interfaces, (i, interfaces)
 
-    assert channel_props['TargetID'] == 'foo at bar.com', channel_props
+    assert channel_props['TargetID'] == jt.remote_bare_jid, channel_props
     assert channel_props['Requested'] == True
     assert channel_props['InitiatorID'] == 'test at localhost'
     assert channel_props['InitiatorHandle'] == self_handle
-- 
1.5.6.5




More information about the telepathy-commits mailing list