telepathy-idle: stop using RequestHandles when joining channels

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Mon Sep 23 04:53:09 PDT 2013


Module: telepathy-idle
Branch: master
Commit: 5bcc7ad038b9df160f2a2c402e78455fc9015847
URL:    http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=5bcc7ad038b9df160f2a2c402e78455fc9015847

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Fri Sep 20 13:00:51 2013 +0200

stop using RequestHandles when joining channels

RequestHandles will be removed in Telepathy 1.0

---

 tests/twisted/channels/join-muc-channel-bouncer.py |    3 ---
 tests/twisted/channels/join-muc-channel.py         |   18 ++++++------------
 tests/twisted/channels/requests-muc.py             |    2 --
 tests/twisted/messages/contactinfo-request.py      |   11 +++++++----
 tests/twisted/messages/long-message-split.py       |    9 +++++----
 tests/twisted/messages/message-order.py            |    9 +++++----
 tests/twisted/messages/room-contact-mixup.py       |   10 ++++++----
 7 files changed, 29 insertions(+), 33 deletions(-)

diff --git a/tests/twisted/channels/join-muc-channel-bouncer.py b/tests/twisted/channels/join-muc-channel-bouncer.py
index 09f12a1..8389c84 100644
--- a/tests/twisted/channels/join-muc-channel-bouncer.py
+++ b/tests/twisted/channels/join-muc-channel-bouncer.py
@@ -10,7 +10,6 @@ from servicetest import (
 from constants import *
 
 def test_join_bouncer(q, conn, stream, room):
-    room_handles = conn.RequestHandles(HT_ROOM, [room])
     stream.sendJoin(room)
 
     new_channels = EventPattern('dbus-signal', signal='NewChannels')
@@ -20,7 +19,6 @@ def test_join_bouncer(q, conn, stream, room):
     assertEquals(1, len(channel_details))
     path, props = channel_details[0]
     assertEquals(HT_ROOM, props[TARGET_HANDLE_TYPE])
-    assertEquals(room_handles[0], props[TARGET_HANDLE])
     assertEquals(CHANNEL_TYPE_TEXT, props[CHANNEL_TYPE])
 
     new_channel = EventPattern('dbus-signal', signal='NewChannel')
@@ -28,7 +26,6 @@ def test_join_bouncer(q, conn, stream, room):
     q.forbid_events([new_channel])
     assertEquals(CHANNEL_TYPE_TEXT, event.args[1])
     assertEquals(HT_ROOM, event.args[2])
-    assertEquals(room_handles[0], event.args[3])
 
     q.expect('dbus-signal', signal='MembersChanged')
 
diff --git a/tests/twisted/channels/join-muc-channel.py b/tests/twisted/channels/join-muc-channel.py
index 613756e..de3235a 100644
--- a/tests/twisted/channels/join-muc-channel.py
+++ b/tests/twisted/channels/join-muc-channel.py
@@ -16,10 +16,13 @@ def test(q, bus, conn, stream):
     q.expect('dbus-signal', signal='SelfHandleChanged',
         args=[1L])
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
-    room_handles = conn.RequestHandles(HT_ROOM, ['#idletest'])
-    call_async(q, conn, 'RequestChannel', CHANNEL_TYPE_TEXT, HT_ROOM, room_handles[0], True)
+    call_async(q, conn.Requests, 'CreateChannel',
+            { CHANNEL_TYPE: CHANNEL_TYPE_TEXT,
+              TARGET_HANDLE_TYPE: HT_ROOM,
+              TARGET_ID: '#idletest' })
+
     q.expect('stream-JOIN')
-    event = q.expect('dbus-return', method='RequestChannel')
+    event = q.expect('dbus-return', method='CreateChannel')
     obj_path = event.value[0]
 
     pattern = EventPattern('dbus-signal', signal='NewChannels')
@@ -30,17 +33,8 @@ def test(q, bus, conn, stream):
     path, props = channel_details[0]
     assert path == obj_path
     assert props[TARGET_HANDLE_TYPE] == HT_ROOM
-    assert props[TARGET_HANDLE] == room_handles[0]
     assert props[CHANNEL_TYPE] == CHANNEL_TYPE_TEXT
 
-    pattern = EventPattern('dbus-signal', signal='NewChannel')
-    event = q.expect_many(pattern)[0]
-    q.forbid_events([pattern])
-    assert event.args[0] == obj_path
-    assert event.args[1] == CHANNEL_TYPE_TEXT
-    assert event.args[2] == HT_ROOM
-    assert event.args[3] == room_handles[0]
-
     q.expect('dbus-signal', signal='MembersChanged')
     call_async(q, conn, 'Disconnect')
     q.expect_many(
diff --git a/tests/twisted/channels/requests-muc.py b/tests/twisted/channels/requests-muc.py
index b54091c..aa11d1b 100644
--- a/tests/twisted/channels/requests-muc.py
+++ b/tests/twisted/channels/requests-muc.py
@@ -95,8 +95,6 @@ def test(q, bus, conn, stream, use_room=False):
     assert props[cs.TARGET_ID] == '#idletest'
     assertEquals('#idletest', props[cs.ROOM_NAME])
     assertEquals('', props[cs.ROOM_SERVER])
-    assert props[cs.TARGET_HANDLE] == \
-        conn.RequestHandles(cs.HT_ROOM, ['#idletest'])[0]
     assert props[cs.REQUESTED]
     assert props[cs.INITIATOR_HANDLE] == self_handle
     assert props[cs.INITIATOR_ID] == \
diff --git a/tests/twisted/messages/contactinfo-request.py b/tests/twisted/messages/contactinfo-request.py
index 1350afe..bba13aa 100644
--- a/tests/twisted/messages/contactinfo-request.py
+++ b/tests/twisted/messages/contactinfo-request.py
@@ -43,10 +43,13 @@ def test(q, bus, conn, stream):
 
     self_handle = conn.GetSelfHandle()
 
-    room_handles = conn.RequestHandles(HT_ROOM, CHANNEL_NAMES)
-    for room_handle in room_handles:
-        call_async(q, conn, 'RequestChannel', CHANNEL_TYPE_TEXT, HT_ROOM, room_handle, True)
-        q.expect('dbus-return', method='RequestChannel')
+    for name in CHANNEL_NAMES:
+        call_async(q, conn.Requests, 'CreateChannel',
+                { CHANNEL_TYPE: CHANNEL_TYPE_TEXT,
+                   TARGET_HANDLE_TYPE: HT_ROOM,
+                   TARGET_ID: name })
+
+        q.expect('dbus-return', method='CreateChannel')
         q.expect('dbus-signal', signal='NewChannels')
 
     contact_info = dbus.Interface(conn, CONN_IFACE_CONTACT_INFO)
diff --git a/tests/twisted/messages/long-message-split.py b/tests/twisted/messages/long-message-split.py
index 88c11aa..fc8ce87 100644
--- a/tests/twisted/messages/long-message-split.py
+++ b/tests/twisted/messages/long-message-split.py
@@ -35,11 +35,12 @@ def test(q, bus, conn, stream):
     conn.Connect()
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
     CHANNEL_NAME = '#idletest'
-    room_handles = conn.RequestHandles(HT_ROOM, [CHANNEL_NAME])
-    call_async(q, conn, 'RequestChannel', CHANNEL_TYPE_TEXT, HT_ROOM,
-            room_handles[0], True)
+    call_async(q, conn.Requests, 'CreateChannel',
+            { CHANNEL_TYPE: CHANNEL_TYPE_TEXT,
+              TARGET_HANDLE_TYPE: HT_ROOM,
+              TARGET_ID: CHANNEL_NAME })
 
-    ret = q.expect('dbus-return', method='RequestChannel')
+    ret = q.expect('dbus-return', method='CreateChannel')
     q.expect('dbus-signal', signal='MembersChanged')
     chan = bus.get_object(conn.bus_name, ret.value[0])
 
diff --git a/tests/twisted/messages/message-order.py b/tests/twisted/messages/message-order.py
index 545c183..d307e29 100644
--- a/tests/twisted/messages/message-order.py
+++ b/tests/twisted/messages/message-order.py
@@ -14,11 +14,12 @@ def test(q, bus, conn, stream):
     conn.Connect()
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
     CHANNEL_NAME = '#idletest'
-    room_handles = conn.RequestHandles(HT_ROOM, [CHANNEL_NAME])
-    call_async(q, conn, 'RequestChannel', CHANNEL_TYPE_TEXT, HT_ROOM,
-            room_handles[0], True)
+    call_async(q, conn.Requests, 'CreateChannel',
+            { CHANNEL_TYPE: CHANNEL_TYPE_TEXT,
+              TARGET_HANDLE_TYPE: HT_ROOM,
+              TARGET_ID: CHANNEL_NAME })
 
-    ret = q.expect('dbus-return', method='RequestChannel')
+    ret = q.expect('dbus-return', method='CreateChannel')
     q.expect('dbus-signal', signal='MembersChanged')
     chan = bus.get_object(conn.bus_name, ret.value[0])
 
diff --git a/tests/twisted/messages/room-contact-mixup.py b/tests/twisted/messages/room-contact-mixup.py
index 2c0ab8c..e53b454 100644
--- a/tests/twisted/messages/room-contact-mixup.py
+++ b/tests/twisted/messages/room-contact-mixup.py
@@ -25,11 +25,13 @@ def test(q, bus, conn, stream):
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
 
     # join a chat room with the same name as our nick
-    room_handles = conn.RequestHandles(HT_ROOM, [CHANNEL])
-    call_async(q, conn, 'RequestChannel', CHANNEL_TYPE_TEXT, HT_ROOM,
-            room_handles[0], True)
+    call_async(q, conn.Requests,'CreateChannel',
+            { CHANNEL_TYPE: CHANNEL_TYPE_TEXT,
+              TARGET_HANDLE_TYPE: HT_ROOM,
+              TARGET_ID: CHANNEL })
+
     # wait for the join to finish
-    ret = q.expect('dbus-return', method='RequestChannel')
+    ret = q.expect('dbus-return', method='CreateChannel')
     muc_path = ret.value
     chan = bus.get_object(conn.bus_name, ret.value[0])
     group_text_chan = dbus.Interface(chan, CHANNEL_TYPE_TEXT)



More information about the telepathy-commits mailing list