diff options
| author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-20 15:31:46 +0100 |
|---|---|---|
| committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-23 10:38:12 +0100 |
| commit | 5735643a1e823ae9b9b50d7b7089531e1f7c8924 (patch) | |
| tree | a8b0e3eb0b4fd3ab66ae8b5481402b97938202ef | |
| parent | fc53d06408448f6b565a51c4a6f038517fcfa74c (diff) | |
Avoid calling Group.GetSelfHandle()
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69618
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
| -rw-r--r-- | tests/twisted/muc/kicked.py | 3 | ||||
| -rw-r--r-- | tests/twisted/muc/test-muc-invitation.py | 22 | ||||
| -rw-r--r-- | tests/twisted/muc/test-muc.py | 3 | ||||
| -rw-r--r-- | tests/twisted/olpc/olpc-muc-invitation.py | 10 | ||||
| -rw-r--r-- | tests/twisted/olpc/olpc-muc-prop-change.py | 13 |
5 files changed, 28 insertions, 23 deletions
diff --git a/tests/twisted/muc/kicked.py b/tests/twisted/muc/kicked.py index e32648853..42c0f5d89 100644 --- a/tests/twisted/muc/kicked.py +++ b/tests/twisted/muc/kicked.py @@ -15,7 +15,8 @@ MUC = 'deerhoof@evil.lit' def test(q, bus, conn, stream): # The user happily joins a MUC _, chan, _, _ = join_muc(q, bus, conn, stream, MUC) - muc_self_handle = chan.Group.GetSelfHandle() + muc_self_handle = chan.Properties.Get(cs.CHANNEL_IFACE_GROUP, + "SelfHandle") muc_self_jid, = conn.InspectHandles(cs.HT_CONTACT, [muc_self_handle]) # But then Bob kicks us. diff --git a/tests/twisted/muc/test-muc-invitation.py b/tests/twisted/muc/test-muc-invitation.py index e30c68dc2..797a4395c 100644 --- a/tests/twisted/muc/test-muc-invitation.py +++ b/tests/twisted/muc/test-muc-invitation.py @@ -7,7 +7,7 @@ import dbus from twisted.words.xish import domish, xpath from gabbletest import exec_test, make_muc_presence -from servicetest import call_async, EventPattern +from servicetest import call_async, EventPattern, wrap_channel import constants as cs def test(q, bus, conn, stream): @@ -30,12 +30,12 @@ def test(q, bus, conn, stream): assert event.args[3] == 1 # handle room_handle = 1 - text_chan = bus.get_object(conn.bus_name, event.args[0]) - group_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_GROUP) + text_chan = wrap_channel(bus.get_object(conn.bus_name, event.args[0]), + 'Text') - members = group_iface.GetMembers() - local_pending = group_iface.GetLocalPendingMembers() - remote_pending = group_iface.GetRemotePendingMembers() + members = text_chan.Group.GetMembers() + local_pending = text_chan.Group.GetLocalPendingMembers() + remote_pending = text_chan.Group.GetRemotePendingMembers() assert len(members) == 1 assert conn.InspectHandles(1, members)[0] == 'bob@localhost' @@ -46,11 +46,11 @@ def test(q, bus, conn, stream): 'chat@conf.localhost/test' assert len(remote_pending) == 0 - room_self_handle = group_iface.GetSelfHandle() + room_self_handle = text_chan.Properties.Get(cs.CHANNEL_IFACE_GROUP, + "SelfHandle") assert room_self_handle == local_pending[0] - channel_props = text_chan.GetAll( - cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE) + channel_props = text_chan.Properties.GetAll(cs.CHANNEL) assert channel_props['TargetID'] == 'chat@conf.localhost', channel_props assert channel_props['Requested'] == False assert channel_props['InitiatorID'] == 'bob@localhost' @@ -62,7 +62,7 @@ def test(q, bus, conn, stream): conn.SimplePresence.SetPresence('available', 'success') # accept the invitation - call_async(q, group_iface, 'AddMembers', [room_self_handle], 'Oh, OK then') + call_async(q, text_chan.Group, 'AddMembers', [room_self_handle], 'Oh, OK then') event, event2, _ = q.expect_many( EventPattern('stream-presence', to='chat@conf.localhost/test'), @@ -97,7 +97,7 @@ def test(q, bus, conn, stream): # Test sending an invitation alice_handle = conn.RequestHandles(1, ['alice@localhost'])[0] - call_async(q, group_iface, 'AddMembers', [alice_handle], + call_async(q, text_chan.Group, 'AddMembers', [alice_handle], 'I want to test invitations') event = q.expect('stream-message', to='chat@conf.localhost') diff --git a/tests/twisted/muc/test-muc.py b/tests/twisted/muc/test-muc.py index 879996bff..01f00a837 100644 --- a/tests/twisted/muc/test-muc.py +++ b/tests/twisted/muc/test-muc.py @@ -265,7 +265,8 @@ def test(q, bus, conn, stream): assert x_muc_nodes is None, elem.toXml() # test that leaving the channel results in an unavailable message - chan.Group.RemoveMembers([chan.Group.GetSelfHandle()], 'booo') + chan.Group.RemoveMembers([chan.Properties.Get(cs.CHANNEL_IFACE_GROUP, + "SelfHandle")], 'booo') event = q.expect('stream-presence', to='chat@conf.localhost/test') elem = event.stanza diff --git a/tests/twisted/olpc/olpc-muc-invitation.py b/tests/twisted/olpc/olpc-muc-invitation.py index 2c9ee92c3..d121bae46 100644 --- a/tests/twisted/olpc/olpc-muc-invitation.py +++ b/tests/twisted/olpc/olpc-muc-invitation.py @@ -7,7 +7,7 @@ import dbus from twisted.words.xish import domish, xpath from gabbletest import exec_test, make_muc_presence -from servicetest import call_async, EventPattern +from servicetest import call_async, EventPattern, wrap_channel import constants as cs import ns @@ -79,8 +79,9 @@ def test(q, bus, conn, stream): assert event.args[2] == 2 # handle type assert event.args[3] == handles['chat'] # handle - text_chan = bus.get_object(conn.bus_name, event.args[0]) - group_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_GROUP) + text_chan = wrap_channel(bus.get_object(conn.bus_name, event.args[0]), + 'Text') + group_iface = text_chan.Group members = group_iface.GetAllMembers()[0] local_pending = group_iface.GetAllMembers()[1] @@ -94,7 +95,8 @@ def test(q, bus, conn, stream): 'chat@conf.localhost/test' assert len(remote_pending) == 0 - handles['chat_self'] = group_iface.GetSelfHandle() + handles['chat_self'] = text_chan.Properties.Get(cs.CHANNEL_IFACE_GROUP, + "SelfHandle") assert handles['chat_self'] == local_pending[0] # by now, we should have picked up the extra activity properties diff --git a/tests/twisted/olpc/olpc-muc-prop-change.py b/tests/twisted/olpc/olpc-muc-prop-change.py index 8a20303a2..eb87a57f7 100644 --- a/tests/twisted/olpc/olpc-muc-prop-change.py +++ b/tests/twisted/olpc/olpc-muc-prop-change.py @@ -7,7 +7,7 @@ import dbus from twisted.words.xish import domish, xpath from gabbletest import exec_test, acknowledge_iq, make_muc_presence -from servicetest import call_async, EventPattern +from servicetest import call_async, EventPattern, wrap_channel import constants as cs import ns @@ -61,9 +61,9 @@ def test(q, bus, conn, stream): assert event.args[3] == 1 # handle room_handle = 1 - text_chan = bus.get_object(conn.bus_name, event.args[0]) - chan_iface = dbus.Interface(text_chan, cs.CHANNEL) - group_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_GROUP) + text_chan = wrap_channel(bus.get_object(conn.bus_name, event.args[0]), + 'Text') + group_iface = text_chan.Group members = group_iface.GetAllMembers()[0] local_pending = group_iface.GetAllMembers()[1] @@ -78,7 +78,8 @@ def test(q, bus, conn, stream): 'chat@conf.localhost/test' assert len(remote_pending) == 0 - room_self_handle = group_iface.GetSelfHandle() + room_self_handle = text_chan.Properties.Get(cs.CHANNEL_IFACE_GROUP, + "SelfHandle") assert room_self_handle == local_pending[0] # by now, we should have picked up the extra activity properties @@ -359,7 +360,7 @@ def test(q, bus, conn, stream): q.expect('dbus-return', method='SetProperties') - chan_iface.Close() + text_chan.Close() # we must echo the MUC presence so the room will actually close event = q.expect('stream-presence', to='chat@conf.localhost/test', |
