[telepathy-gabble/master] Use HT_CONTACT and real self_handle in some tests
Will Thompson
will.thompson at collabora.co.uk
Wed Mar 18 06:09:52 PDT 2009
---
tests/twisted/jingle/google-relay.py | 6 +++---
tests/twisted/jingle/test-description-info.py | 9 +++++----
tests/twisted/jingle/test-dialects-incoming.py | 11 +++++++----
tests/twisted/jingle/test-incoming-call-reject.py | 9 ++++++---
tests/twisted/jingle/test-outgoing-call.py | 5 +++--
5 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/tests/twisted/jingle/google-relay.py b/tests/twisted/jingle/google-relay.py
index 3806d75..3d32a25 100644
--- a/tests/twisted/jingle/google-relay.py
+++ b/tests/twisted/jingle/google-relay.py
@@ -8,7 +8,7 @@ from servicetest import make_channel_proxy, tp_path_prefix, \
EventPattern, call_async, sync_dbus
import jingletest
import gabbletest
-import constants as c
+import constants as cs
import dbus
import time
import BaseHTTPServer
@@ -175,7 +175,7 @@ def test(q, bus, conn, stream, incoming=True, too_slow=False):
media_iface = make_channel_proxy(conn, path,
'Channel.Type.StreamedMedia')
call_async(q, media_iface, 'RequestStreams',
- remote_handle, [c.MEDIA_STREAM_TYPE_AUDIO])
+ remote_handle, [cs.MEDIA_STREAM_TYPE_AUDIO])
# S-E gets notified about new session handler, and calls Ready on it
e = q.expect('dbus-signal', signal='NewSessionHandler')
@@ -314,7 +314,7 @@ def test_too_slow(q, bus, conn, stream, httpd, media_chan):
"""
# User gets bored, and closes the channel.
- call_async(q, media_chan, 'Close', dbus_interface=c.CHANNEL)
+ call_async(q, media_chan, 'Close', dbus_interface=cs.CHANNEL)
q.expect('dbus-signal', signal='Closed')
# Now Google answers!
diff --git a/tests/twisted/jingle/test-description-info.py b/tests/twisted/jingle/test-description-info.py
index a0e36c6..7e3f23c 100644
--- a/tests/twisted/jingle/test-description-info.py
+++ b/tests/twisted/jingle/test-description-info.py
@@ -42,7 +42,8 @@ def test(q, bus, conn, stream):
jt2 = JingleTest2(jp, conn, q, stream, 'test at localhost', 'foo at bar.com/Foo')
jt2.prepare()
- remote_handle = conn.RequestHandles(1, ["foo at bar.com/Foo"])[0]
+ self_handle = conn.GetSelfHandle()
+ remote_handle = conn.RequestHandles(cs.HT_CONTACT, ["foo at bar.com/Foo"])[0]
# Remote end calls us
node = jp.SetIq(jt2.peer, jt2.jid, [
@@ -60,7 +61,7 @@ def test(q, bus, conn, stream):
# We're pending because of remote_handle
e = q.expect('dbus-signal', signal='MembersChanged',
- args=[u'', [], [], [1L], [], remote_handle, 0])
+ args=[u'', [], [], [self_handle], [], remote_handle, 0])
media_chan = make_channel_proxy(conn, tp_path_prefix + e.path, 'Channel.Interface.Group')
signalling_iface = make_channel_proxy(conn, tp_path_prefix + e.path, 'Channel.Interface.MediaSignalling')
@@ -73,7 +74,7 @@ def test(q, bus, conn, stream):
session_handler = make_channel_proxy(conn, e.args[0], 'Media.SessionHandler')
session_handler.Ready()
- media_chan.AddMembers([dbus.UInt32(1)], 'accepted')
+ media_chan.AddMembers([self_handle], 'accepted')
# S-E gets notified about a newly-created stream
e = q.expect('dbus-signal', signal='NewStreamHandler')
@@ -87,7 +88,7 @@ def test(q, bus, conn, stream):
# we are now both in members
members = media_chan.GetMembers()
- assert set(members) == set([1L, remote_handle]), members
+ assert set(members) == set([self_handle, remote_handle]), members
local_codecs = [('GSM', 3, 8000, {}),
('PCMA', 8, 8000, {'helix':'woo yay'}),
diff --git a/tests/twisted/jingle/test-dialects-incoming.py b/tests/twisted/jingle/test-dialects-incoming.py
index 50a710c..d7d4cd1 100644
--- a/tests/twisted/jingle/test-dialects-incoming.py
+++ b/tests/twisted/jingle/test-dialects-incoming.py
@@ -10,6 +10,8 @@ import dbus
import time
from twisted.words.xish import xpath
+import constants as cs
+
from jingletest2 import *
def worker(jp, q, bus, conn, stream):
@@ -17,7 +19,8 @@ def worker(jp, q, bus, conn, stream):
jt2 = JingleTest2(jp, conn, q, stream, 'test at localhost', 'foo at bar.com/Foo')
jt2.prepare()
- remote_handle = conn.RequestHandles(1, ["foo at bar.com/Foo"])[0]
+ self_handle = conn.GetSelfHandle()
+ remote_handle = conn.RequestHandles(cs.HT_CONTACT, ["foo at bar.com/Foo"])[0]
# Remote end calls us
# jt.incoming_call()
@@ -52,7 +55,7 @@ def worker(jp, q, bus, conn, stream):
session_handler = make_channel_proxy(conn, e.args[0], 'Media.SessionHandler')
session_handler.Ready()
- media_chan.AddMembers([dbus.UInt32(1)], 'accepted')
+ media_chan.AddMembers([self_handle], 'accepted')
# S-E gets notified about a newly-created stream
e = q.expect('dbus-signal', signal='NewStreamHandler')
@@ -61,11 +64,11 @@ def worker(jp, q, bus, conn, stream):
# We are now in members too
e = q.expect_racy('dbus-signal', signal='MembersChanged',
- args=[u'', [1L], [], [], [], 0, 0])
+ args=[u'', [self_handle], [], [], [], 0, 0])
# we are now both in members
members = media_chan.GetMembers()
- assert set(members) == set([1L, remote_handle]), members
+ assert set(members) == set([self_handle, remote_handle]), members
stream_handler.NewNativeCandidate("fake", jt2.get_remote_transports_dbus())
stream_handler.Ready(jt2.get_audio_codecs_dbus())
diff --git a/tests/twisted/jingle/test-incoming-call-reject.py b/tests/twisted/jingle/test-incoming-call-reject.py
index 78c2ff0..9097c18 100644
--- a/tests/twisted/jingle/test-incoming-call-reject.py
+++ b/tests/twisted/jingle/test-incoming-call-reject.py
@@ -10,6 +10,8 @@ import gabbletest
import dbus
import time
+import constants as cs
+
def test(q, bus, conn, stream):
jt = jingletest.JingleTest(stream, 'test at localhost', 'foo at bar.com/Foo')
@@ -39,7 +41,8 @@ def test(q, bus, conn, stream):
# Force Gabble to process the caps before calling RequestChannel
sync_stream(q, stream)
- remote_handle = conn.RequestHandles(1, ["foo at bar.com/Foo"])[0]
+ self_handle = conn.GetSelfHandle()
+ remote_handle = conn.RequestHandles(cs.HT_CONTACT, ["foo at bar.com/Foo"])[0]
# Remote end calls us
jt.incoming_call()
@@ -50,7 +53,7 @@ def test(q, bus, conn, stream):
# We're pending because of remote_handle
e = q.expect('dbus-signal', signal='MembersChanged',
- args=[u'', [], [], [1L], [], remote_handle, 0])
+ args=[u'', [], [], [self_handle], [], remote_handle, 0])
# S-E gets notified about new session handler, and calls Ready on it
e = q.expect('dbus-signal', signal='NewSessionHandler')
@@ -72,7 +75,7 @@ def test(q, bus, conn, stream):
assert channel_props['InitiatorID'] == 'foo at bar.com'
assert channel_props['InitiatorHandle'] == remote_handle
- media_chan.RemoveMembers([dbus.UInt32(1)], 'rejected')
+ media_chan.RemoveMembers([self_handle], 'rejected')
iq, signal = q.expect_many(
EventPattern('stream-iq'),
diff --git a/tests/twisted/jingle/test-outgoing-call.py b/tests/twisted/jingle/test-outgoing-call.py
index ccf16ef..18dd7f2 100644
--- a/tests/twisted/jingle/test-outgoing-call.py
+++ b/tests/twisted/jingle/test-outgoing-call.py
@@ -45,7 +45,8 @@ def test(q, bus, conn, stream):
# Force Gabble to process the caps before calling RequestChannel
sync_stream(q, stream)
- handle = conn.RequestHandles(1, [jt.remote_jid])[0]
+ self_handle = conn.GetSelfHandle()
+ handle = conn.RequestHandles(cs.HT_CONTACT, [jt.remote_jid])[0]
call_async(q, conn, 'RequestChannel',
'org.freedesktop.Telepathy.Channel.Type.StreamedMedia', 0, 0, True)
@@ -183,7 +184,7 @@ def test(q, bus, conn, stream):
# Time passes ... afterwards we close the chan
- group_iface.RemoveMembers([dbus.UInt32(1)], 'closed')
+ group_iface.RemoveMembers([self_handle], 'closed')
# Check that we're the actor
e = q.expect('dbus-signal', signal='MembersChanged')
--
1.5.6.5
More information about the telepathy-commits
mailing list