telepathy-gabble: stop using RequestHandles() to create room channel
Guillaume Desmottes
gdesmott at kemper.freedesktop.org
Fri Oct 4 03:59:17 PDT 2013
Module: telepathy-gabble
Branch: master
Commit: d65bc1f5aace9e76c56bad031c3dddc1510e9fa9
URL: http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=d65bc1f5aace9e76c56bad031c3dddc1510e9fa9
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Thu Oct 3 14:53:06 2013 +0200
stop using RequestHandles() to create room channel
---
tests/twisted/muc/password.py | 5 ++---
tests/twisted/muc/presence-before-closing.py | 5 ++---
tests/twisted/muc/renamed.py | 7 +++----
tests/twisted/muc/test-ensure.py | 20 ++++++++------------
tests/twisted/muc/test-muc-ownership.py | 10 ++++++----
5 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/tests/twisted/muc/password.py b/tests/twisted/muc/password.py
index 7a67d17..0167bfa 100644
--- a/tests/twisted/muc/password.py
+++ b/tests/twisted/muc/password.py
@@ -1,4 +1,4 @@
-from gabbletest import exec_test, elem, request_muc_handle, make_muc_presence
+from gabbletest import exec_test, elem, make_muc_presence
from servicetest import call_async, EventPattern, wrap_channel, assertEquals
import constants as cs
import ns
@@ -12,12 +12,11 @@ def expect_attempt(q, expected_muc_jid, expected_password):
def test(q, bus, conn, stream):
room = 'chat at conf.localhost'
- handle = request_muc_handle(q, conn, stream, room)
call_async(q, conn.Requests, 'CreateChannel', {
cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
- cs.TARGET_HANDLE: handle})
+ cs.TARGET_ID: room })
expected_muc_jid = '%s/%s' % (room, 'test')
q.expect('stream-presence', to=expected_muc_jid)
diff --git a/tests/twisted/muc/presence-before-closing.py b/tests/twisted/muc/presence-before-closing.py
index d62299d..5ae7e27 100644
--- a/tests/twisted/muc/presence-before-closing.py
+++ b/tests/twisted/muc/presence-before-closing.py
@@ -3,7 +3,7 @@ Test for fd.o#19930.
"""
from gabbletest import (
- exec_test, request_muc_handle, wrap_channel, elem,
+ exec_test, wrap_channel, elem,
)
from servicetest import (EventPattern, assertEquals,
sync_dbus, call_async)
@@ -102,12 +102,11 @@ def test_then_disconnect(q, bus, conn, stream):
def test_with_password(q, bus, conn, stream):
room = 'chat at conf.localhost'
- handle = request_muc_handle(q, conn, stream, room)
call_async(q, conn.Requests, 'CreateChannel', {
cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
- cs.TARGET_HANDLE: handle})
+ cs.TARGET_ID: room })
expected_muc_jid = '%s/%s' % (room, 'test')
q.expect('stream-presence', to=expected_muc_jid)
diff --git a/tests/twisted/muc/renamed.py b/tests/twisted/muc/renamed.py
index 0fa6275..a5578b5 100644
--- a/tests/twisted/muc/renamed.py
+++ b/tests/twisted/muc/renamed.py
@@ -5,13 +5,13 @@ Test dealing with the server giving you a nick you didn't ask for.
import dbus
from gabbletest import (
- exec_test, make_muc_presence, request_muc_handle
+ exec_test, make_muc_presence
)
from servicetest import call_async, unwrap
from constants import (
HT_ROOM,
CONN_IFACE_REQUESTS, CHANNEL_TYPE_TEXT, CHANNEL_IFACE_GROUP,
- CHANNEL_TYPE, TARGET_HANDLE_TYPE, TARGET_HANDLE,
+ CHANNEL_TYPE, TARGET_HANDLE_TYPE, TARGET_ID,
)
import constants as cs
@@ -21,12 +21,11 @@ def test(q, bus, conn, stream):
requests = dbus.Interface(conn, CONN_IFACE_REQUESTS)
room_jid = 'chat at conf.localhost'
- room_handle = request_muc_handle(q, conn, stream, room_jid)
call_async(q, requests, 'CreateChannel',
dbus.Dictionary({ CHANNEL_TYPE: CHANNEL_TYPE_TEXT,
TARGET_HANDLE_TYPE: HT_ROOM,
- TARGET_HANDLE: room_handle,
+ TARGET_ID: room_jid,
}, signature='sv'))
expected_jid = '%s/%s' % (room_jid, 'test')
diff --git a/tests/twisted/muc/test-ensure.py b/tests/twisted/muc/test-ensure.py
index 328085f..f015051 100644
--- a/tests/twisted/muc/test-ensure.py
+++ b/tests/twisted/muc/test-ensure.py
@@ -12,25 +12,21 @@ def test(q, bus, conn, stream):
# Need to call this asynchronously as it involves Gabble sending us a
# query.
jids = ['chat at conf.localhost', 'chien at conf.localhost']
- call_async(q, conn, 'RequestHandles', 2, jids)
- event = q.expect('dbus-return', method='RequestHandles')
- room_handles = event.value[0]
+ test_create_ensure(q, conn, bus, stream, jids[0])
+ test_ensure_ensure(q, conn, bus, stream, jids[1])
- test_create_ensure(q, conn, bus, stream, jids[0], room_handles[0])
- test_ensure_ensure(q, conn, bus, stream, jids[1], room_handles[1])
-
-def test_create_ensure(q, conn, bus, stream, room_jid, room_handle):
+def test_create_ensure(q, conn, bus, stream, room_jid):
# Call both Create and Ensure for the same channel.
call_async(q, conn.Requests, 'CreateChannel',
{ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
- cs.TARGET_HANDLE: room_handle,
+ cs.TARGET_ID: room_jid,
})
call_async(q, conn.Requests, 'EnsureChannel',
{ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
- cs.TARGET_HANDLE: room_handle,
+ cs.TARGET_ID: room_jid,
})
mc, _ = q.expect_many(
@@ -84,17 +80,17 @@ def test_create_ensure(q, conn, bus, stream, room_jid, room_handle):
c_props[cs.DELIVERY_REPORTING_SUPPORT])
-def test_ensure_ensure(q, conn, bus, stream, room_jid, room_handle):
+def test_ensure_ensure(q, conn, bus, stream, room_jid):
# Call Ensure twice for the same channel.
call_async(q, conn.Requests, 'EnsureChannel',
{ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
- cs.TARGET_HANDLE: room_handle,
+ cs.TARGET_ID: room_jid,
})
call_async(q, conn.Requests, 'EnsureChannel',
{ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
- cs.TARGET_HANDLE: room_handle,
+ cs.TARGET_ID: room_jid,
})
mc, _ = q.expect_many(
diff --git a/tests/twisted/muc/test-muc-ownership.py b/tests/twisted/muc/test-muc-ownership.py
index 655e93f..2b6af8d 100644
--- a/tests/twisted/muc/test-muc-ownership.py
+++ b/tests/twisted/muc/test-muc-ownership.py
@@ -16,10 +16,12 @@ import constants as cs
def test(q, bus, conn, stream):
self_handle = conn.Properties.Get(cs.CONN, "SelfHandle")
- room_handle = conn.RequestHandles(cs.HT_ROOM, ['chat at conf.localhost'])[0]
- call_async(q, conn, 'RequestChannel', cs.CHANNEL_TYPE_TEXT, cs.HT_ROOM,
- room_handle, True)
+ call_async(q, conn.Requests, 'CreateChannel',
+ { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+ cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
+ cs.TARGET_ID: 'chat at conf.localhost'
+ })
gfc, _, _, _ = q.expect_many(
# Initial group flags
@@ -77,7 +79,7 @@ def test(q, bus, conn, stream):
assertEquals(expected_members, sorted(added))
assertEquals(expected_owners, owners)
- event = q.expect('dbus-return', method='RequestChannel')
+ event = q.expect('dbus-return', method='CreateChannel')
chan = wrap_channel(bus.get_object(conn.bus_name, event.value[0]), 'Text')
More information about the telepathy-commits
mailing list