diff options
Diffstat (limited to 'tests/twisted/muc/test-ensure.py')
-rw-r--r-- | tests/twisted/muc/test-ensure.py | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/tests/twisted/muc/test-ensure.py b/tests/twisted/muc/test-ensure.py index e03ae3567..858385256 100644 --- a/tests/twisted/muc/test-ensure.py +++ b/tests/twisted/muc/test-ensure.py @@ -3,7 +3,7 @@ Test that EnsureChannel works for MUCs, particularly in the case when there are several pending requests for the same MUC. """ -from gabbletest import make_result_iq, exec_test, make_muc_presence +from gabbletest import exec_test, make_muc_presence from servicetest import (call_async, EventPattern, assertContains, assertEquals) import constants as cs @@ -12,31 +12,27 @@ def test(q, bus, conn, stream): # Need to call this asynchronously as it involves Gabble sending us a # query. jids = ['chat@conf.localhost', 'chien@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( - EventPattern('dbus-signal', signal='MembersChanged'), + EventPattern('dbus-signal', signal='MembersChangedDetailed'), EventPattern('stream-presence', to=('%s/test' % room_jid))) - msg, added, removed, local_pending, remote_pending, actor, reason = mc.args + added, removed, local_pending, remote_pending, details = mc.args assert added == [], mc.args assert removed == [], mc.args @@ -49,15 +45,15 @@ def test_create_ensure(q, conn, bus, stream, room_jid, room_handle): # Send presence for own membership of room. stream.send(make_muc_presence('none', 'participant', room_jid, 'test')) - mc = q.expect('dbus-signal', signal='MembersChanged') - msg, added, removed, local_pending, remote_pending, actor, reason = mc.args + mc = q.expect('dbus-signal', signal='MembersChangedDetailed') + added, removed, local_pending, remote_pending, details = mc.args assert len(added) == 2, mc.args assert removed == [], mc.args assert local_pending == [], mc.args assert remote_pending == [], mc.args - members = conn.InspectHandles(1, added) + members = conn.inspect_contacts_sync(added) members.sort() assert members == ['%s/bob' % room_jid, '%s/test' % room_jid], members @@ -84,23 +80,23 @@ 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( - EventPattern('dbus-signal', signal='MembersChanged'), + EventPattern('dbus-signal', signal='MembersChangedDetailed'), EventPattern('stream-presence', to=('%s/test' % room_jid))) - msg, added, removed, local_pending, remote_pending, actor, reason = mc.args + added, removed, local_pending, remote_pending, details = mc.args assert added == [], mc.args assert removed == [], mc.args @@ -113,15 +109,15 @@ def test_ensure_ensure(q, conn, bus, stream, room_jid, room_handle): # Send presence for own membership of room. stream.send(make_muc_presence('none', 'participant', room_jid, 'test')) - mc = q.expect('dbus-signal', signal='MembersChanged') - msg, added, removed, local_pending, remote_pending, actor, reason = mc.args + mc = q.expect('dbus-signal', signal='MembersChangedDetailed') + added, removed, local_pending, remote_pending, details = mc.args assert len(added) == 2, mc.args assert removed == [], mc.args assert local_pending == [], mc.args assert remote_pending == [], mc.args - members = conn.InspectHandles(1, added) + members = conn.inspect_contacts_sync(added) members.sort() assert members == ['%s/bob' % room_jid, '%s/test' % room_jid], members |