From 59f5621916c64de8f4b61eb938bc36c5c78a3010 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 20 Sep 2013 14:43:39 +0100 Subject: [PATCH 02/10] Tests: replace GetSelfHandle calls with property-getting sed expression: s/\.GetSelfHandle()/.Properties.Get(cs.CONN, "SelfHandle")/g adjusted by hand to exclude Group.GetSelfHandle() calls. --- tests/twisted/caps/tube-caps.py | 4 ++-- tests/twisted/file-transfer/file_transfer_helper.py | 2 +- tests/twisted/file-transfer/ft-client-caps.py | 4 ++-- tests/twisted/jingle-share/file_transfer_helper.py | 2 +- tests/twisted/jingle-share/test-multift.py | 2 +- tests/twisted/jingle/call-codecoffer.py | 2 +- tests/twisted/jingle/call-muc.py | 4 ++-- tests/twisted/jingle/call_helper.py | 2 +- tests/twisted/muc/avatars.py | 2 +- tests/twisted/muc/name-conflict.py | 2 +- tests/twisted/muc/renamed.py | 2 +- tests/twisted/muc/roomlist.py | 6 +++--- tests/twisted/muc/test-muc-alias.py | 2 +- tests/twisted/muc/test-muc-ownership.py | 2 +- tests/twisted/muc/test-muc.py | 2 +- tests/twisted/presence/shared-status.py | 4 ++-- tests/twisted/roster/removed-from-rp-subscribe.py | 2 +- tests/twisted/roster/test-google-roster.py | 6 +++--- tests/twisted/sasl/complex.py | 2 +- tests/twisted/test-debug.py | 4 ++-- tests/twisted/text/destroy.py | 2 +- tests/twisted/text/ensure.py | 2 +- tests/twisted/text/facebook-own-message.py | 2 +- tests/twisted/text/initiate-requestotron.py | 2 +- tests/twisted/text/initiate.py | 2 +- tests/twisted/text/respawn.py | 2 +- tests/twisted/text/send-error.py | 4 ++-- tests/twisted/text/test-chat-state.py | 2 +- tests/twisted/text/test-text.py | 2 +- tests/twisted/tubes/accept-private-dbus-tube.py | 2 +- tests/twisted/tubes/offer-muc-dbus-tube.py | 2 +- tests/twisted/tubes/offer-private-dbus-tube.py | 2 +- tests/twisted/tubes/offer-private-stream-tube.py | 2 +- tests/twisted/tubes/tubetestutil.py | 2 +- tests/twisted/vcard/overlapping-sets.py | 2 +- tests/twisted/vcard/test-avatar-async.py | 2 +- tests/twisted/vcard/test-set-alias.py | 2 +- tests/twisted/vcard/test-vcard-cache.py | 2 +- tests/twisted/vcard/test-vcard-race.py | 3 ++- tests/twisted/vcard/update-get-failed.py | 2 +- 40 files changed, 51 insertions(+), 50 deletions(-) diff --git a/tests/twisted/caps/tube-caps.py b/tests/twisted/caps/tube-caps.py index 3d3f698..903b240 100644 --- a/tests/twisted/caps/tube-caps.py +++ b/tests/twisted/caps/tube-caps.py @@ -227,7 +227,7 @@ def test_tube_caps_from_contact(q, bus, conn, stream, contact): def advertise_caps(q, conn, stream, filters, expected_features, unexpected_features, expected_caps): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") ret_caps = conn.ContactCapabilities.UpdateCapabilities( [(cs.CLIENT + '.Foo', filters, [])]) @@ -255,7 +255,7 @@ def advertise_caps(q, conn, stream, filters, expected_features, unexpected_featu assertSameElements(caps[self_handle], caps_via_contacts_iface) def test_tube_caps_to_contact(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") basic_caps = dbus.Dictionary({self_handle: [(text_fixed_properties, text_allowed_properties), diff --git a/tests/twisted/file-transfer/file_transfer_helper.py b/tests/twisted/file-transfer/file_transfer_helper.py index 79b3acf..3679c37 100644 --- a/tests/twisted/file-transfer/file_transfer_helper.py +++ b/tests/twisted/file-transfer/file_transfer_helper.py @@ -88,7 +88,7 @@ class FileTransferTest(object): announce_socks5_proxy(self.q, self.stream, disco_event.stanza) - self.self_handle = self.conn.GetSelfHandle() + self.self_handle = self.conn.Properties.Get(cs.CONN, "SelfHandle") self.self_handle_name = self.conn.InspectHandles(cs.HT_CONTACT, [self.self_handle])[0] def announce_contact(self, name=CONTACT_NAME, metadata=True): diff --git a/tests/twisted/file-transfer/ft-client-caps.py b/tests/twisted/file-transfer/ft-client-caps.py index 336d7a0..fc327ac 100644 --- a/tests/twisted/file-transfer/ft-client-caps.py +++ b/tests/twisted/file-transfer/ft-client-caps.py @@ -179,7 +179,7 @@ def advertise_caps(q, bus, conn, stream, filters, expected_features, unexpected_ # make sure nothing from a previous update is still running sync_dbus(bus, q, conn) - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") ret_caps = conn.ContactCapabilities.UpdateCapabilities( [(cs.CLIENT + '.Foo', filters, [])]) @@ -207,7 +207,7 @@ def advertise_caps(q, bus, conn, stream, filters, expected_features, unexpected_ assertSameElements(caps[self_handle], caps_via_contacts_iface) def test_ft_caps_to_contact(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") basic_caps = [ (text_fixed_properties, text_allowed_properties), diff --git a/tests/twisted/jingle-share/file_transfer_helper.py b/tests/twisted/jingle-share/file_transfer_helper.py index 19a45ca..3e8b274 100644 --- a/tests/twisted/jingle-share/file_transfer_helper.py +++ b/tests/twisted/jingle-share/file_transfer_helper.py @@ -77,7 +77,7 @@ class FileTransferTest(object): args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED], path=self.conn.object.object_path) - self.self_handle = self.conn.GetSelfHandle() + self.self_handle = self.conn.Properties.Get(cs.CONN, "SelfHandle") self.self_handle_name = self.conn.InspectHandles(cs.HT_CONTACT, [self.self_handle])[0] def set_target(self, jid): diff --git a/tests/twisted/jingle-share/test-multift.py b/tests/twisted/jingle-share/test-multift.py index 41da7c6..ac9f675 100644 --- a/tests/twisted/jingle-share/test-multift.py +++ b/tests/twisted/jingle-share/test-multift.py @@ -25,7 +25,7 @@ def test(q, bus, conn, stream): test_ft_caps_from_contact(q, bus, conn, stream, contact, 2L, client) - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jid = conn.InspectHandles(cs.HT_CONTACT, [self_handle])[0] iq = IQ(stream, "set") diff --git a/tests/twisted/jingle/call-codecoffer.py b/tests/twisted/jingle/call-codecoffer.py index d3a3f82..0353d9f 100644 --- a/tests/twisted/jingle/call-codecoffer.py +++ b/tests/twisted/jingle/call-codecoffer.py @@ -76,7 +76,7 @@ def prepare_test(jp, q, bus, conn, stream): jt2.prepare() - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") remote_handle = conn.RequestHandles(1, ["foo@bar.com/Foo"])[0] # Advertise that we can do new style calls diff --git a/tests/twisted/jingle/call-muc.py b/tests/twisted/jingle/call-muc.py index 715a3e2..213e4b4 100644 --- a/tests/twisted/jingle/call-muc.py +++ b/tests/twisted/jingle/call-muc.py @@ -35,7 +35,7 @@ def run_incoming_test(q, bus, conn, stream, bob_leaves_room = False): jt.prepare() forbidden = [ no_muji_presences (muc) ] - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") _, _, test_handle, bob_handle = \ join_muc_and_check(q, bus, conn, stream, muc) @@ -173,7 +173,7 @@ def run_outgoing_test(q, bus, conn, stream, close_channel=False): jt = JingleTest2(jp, conn, q, stream, 'test@localhost', muc + '/bob') jt.prepare() - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") # Not allowed to have muji related presences before we accept the channel forbidden = [ no_muji_presences (muc) ] diff --git a/tests/twisted/jingle/call_helper.py b/tests/twisted/jingle/call_helper.py index 8e070de..b9cc0e5 100644 --- a/tests/twisted/jingle/call_helper.py +++ b/tests/twisted/jingle/call_helper.py @@ -56,7 +56,7 @@ class CallTest(object): self.PEER_JID) self.can_change_direction = (jp.dialect not in ['gtalk-v0.3', 'gtalk-v0.4']) - self.self_handle = conn.GetSelfHandle() + self.self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") self.peer_handle = conn.RequestHandles(1, [self.PEER_JID])[0] def check_channel_state(self, state, wait = False): diff --git a/tests/twisted/muc/avatars.py b/tests/twisted/muc/avatars.py index 91cc17f..5e6f68c 100644 --- a/tests/twisted/muc/avatars.py +++ b/tests/twisted/muc/avatars.py @@ -35,7 +35,7 @@ def extract_hash_from_presence(stanza): stanza) def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") # When Gabble initially requests its avatar from the server, it discovers # it has none. diff --git a/tests/twisted/muc/name-conflict.py b/tests/twisted/muc/name-conflict.py index 512c16e..01d9ca2 100644 --- a/tests/twisted/muc/name-conflict.py +++ b/tests/twisted/muc/name-conflict.py @@ -101,7 +101,7 @@ def test_join(q, bus, conn, stream, room_jid, transient_conflict): # Check that test_'s handle owner is us, and that test (if it's there) has # no owner. handle_owners = group_props['HandleOwners'] - assertEquals (conn.GetSelfHandle(), handle_owners[t_]) + assertEquals (conn.Properties.Get(cs.CONN, "SelfHandle"), handle_owners[t_]) if not transient_conflict: assertEquals (0, handle_owners[t]) diff --git a/tests/twisted/muc/renamed.py b/tests/twisted/muc/renamed.py index ed86ed3..215b7d6 100644 --- a/tests/twisted/muc/renamed.py +++ b/tests/twisted/muc/renamed.py @@ -16,7 +16,7 @@ from constants import ( import constants as cs def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") requests = dbus.Interface(conn, CONN_IFACE_REQUESTS) diff --git a/tests/twisted/muc/roomlist.py b/tests/twisted/muc/roomlist.py index c5e37c7..5900267 100644 --- a/tests/twisted/muc/roomlist.py +++ b/tests/twisted/muc/roomlist.py @@ -65,7 +65,7 @@ def test(q, bus, conn, stream): assert props[tp_name_prefix + '.Channel.TargetID'] == '' assert props[tp_name_prefix + '.Channel.Requested'] == True assert props[tp_name_prefix + '.Channel.InitiatorHandle'] \ - == conn.GetSelfHandle() + == conn.Properties.Get(cs.CONN, "SelfHandle") assert props[tp_name_prefix + '.Channel.InitiatorID'] \ == 'test@localhost' assert props[cs.CHANNEL_TYPE_ROOM_LIST + '.Server'] == \ @@ -91,7 +91,7 @@ def test(q, bus, conn, stream): channel_props.get('ChannelType') assert channel_props['Requested'] == True assert channel_props['InitiatorID'] == 'test@localhost' - assert channel_props['InitiatorHandle'] == conn.GetSelfHandle() + assert channel_props['InitiatorHandle'] == conn.Properties.Get(cs.CONN, "SelfHandle") assert chan.Get(cs.CHANNEL_TYPE_ROOM_LIST, 'Server', dbus_interface=dbus.PROPERTIES_IFACE) == \ @@ -122,7 +122,7 @@ def test(q, bus, conn, stream): assert props[tp_name_prefix + '.Channel.TargetID'] == '' assert props[tp_name_prefix + '.Channel.Requested'] == True assert props[tp_name_prefix + '.Channel.InitiatorHandle'] \ - == conn.GetSelfHandle() + == conn.Properties.Get(cs.CONN, "SelfHandle") assert props[tp_name_prefix + '.Channel.InitiatorID'] \ == 'test@localhost' assert props[cs.CHANNEL_TYPE_ROOM_LIST+ '.Server'] == \ diff --git a/tests/twisted/muc/test-muc-alias.py b/tests/twisted/muc/test-muc-alias.py index edfd78b..60c837f 100644 --- a/tests/twisted/muc/test-muc-alias.py +++ b/tests/twisted/muc/test-muc-alias.py @@ -11,7 +11,7 @@ import constants as cs def test(q, bus, conn, stream): expect_and_handle_get_vcard(q, stream) - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") conn.Aliasing.SetAliases({self_handle: 'lala'}) expect_and_handle_set_vcard(q, stream) diff --git a/tests/twisted/muc/test-muc-ownership.py b/tests/twisted/muc/test-muc-ownership.py index f0f2d50..f6abb6d 100644 --- a/tests/twisted/muc/test-muc-ownership.py +++ b/tests/twisted/muc/test-muc-ownership.py @@ -17,7 +17,7 @@ from servicetest import ( import constants as cs def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") room_handle = conn.RequestHandles(cs.HT_ROOM, ['chat@conf.localhost'])[0] call_async(q, conn, 'RequestChannel', cs.CHANNEL_TYPE_TEXT, cs.HT_ROOM, diff --git a/tests/twisted/muc/test-muc.py b/tests/twisted/muc/test-muc.py index a254d8e..879996b 100644 --- a/tests/twisted/muc/test-muc.py +++ b/tests/twisted/muc/test-muc.py @@ -38,7 +38,7 @@ def test(q, bus, conn, stream): assert channel_props['TargetID'] == 'chat@conf.localhost', channel_props assert channel_props['Requested'] == True assert channel_props['InitiatorID'] == 'test@localhost' - assert channel_props['InitiatorHandle'] == conn.GetSelfHandle() + assert channel_props['InitiatorHandle'] == conn.Properties.Get(cs.CONN, "SelfHandle") # Exercise Group Properties from spec 0.17.6 (in a basic way) group_props = chan.Properties.GetAll(cs.CHANNEL_IFACE_GROUP) diff --git a/tests/twisted/presence/shared-status.py b/tests/twisted/presence/shared-status.py index 17945e3..53dab68 100644 --- a/tests/twisted/presence/shared-status.py +++ b/tests/twisted/presence/shared-status.py @@ -37,7 +37,7 @@ def _show_to_shared_status_show(show): return shared_show, shared_invisible def _test_remote_status(q, bus, conn, stream, msg, show, list_attrs): - self = conn.GetSelfHandle() + self = conn.Properties.Get(cs.CONN, "SelfHandle") presence = conn.SimplePresence.GetPresences([self])[self] is_away = presence[0] in (cs.PRESENCE_AWAY, cs.PRESENCE_EXTENDED_AWAY) @@ -78,7 +78,7 @@ def _test_local_status(q, conn, stream, msg, show, expected_show=None): expected_show = expected_show or show away = expected_show in ('away', 'xa') - self = conn.GetSelfHandle() + self = conn.Properties.Get(cs.CONN, "SelfHandle") prev_presence = conn.SimplePresence.GetPresences([self])[self] was_away = prev_presence[0] in (cs.PRESENCE_AWAY, cs.PRESENCE_EXTENDED_AWAY) diff --git a/tests/twisted/roster/removed-from-rp-subscribe.py b/tests/twisted/roster/removed-from-rp-subscribe.py index 8589567..a4e05ab 100644 --- a/tests/twisted/roster/removed-from-rp-subscribe.py +++ b/tests/twisted/roster/removed-from-rp-subscribe.py @@ -30,7 +30,7 @@ def test(q, bus, conn, stream, remove, local, modern): assertLength(0, pairs) # i.e. we've checked all of them - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") h = conn.RequestHandles(cs.HT_CONTACT, [jid])[0] # Another client logged into our account (Gajim, say) wants to subscribe to diff --git a/tests/twisted/roster/test-google-roster.py b/tests/twisted/roster/test-google-roster.py index 257661b..e5fb3f3 100644 --- a/tests/twisted/roster/test-google-roster.py +++ b/tests/twisted/roster/test-google-roster.py @@ -136,7 +136,7 @@ def test_flickering(q, bus, conn, stream, subscribe): Gabble is suppressing the flickers. """ - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") contact = 'bob@foo.com' handle = conn.RequestHandles(cs.HT_CONTACT, ['bob@foo.com'])[0] @@ -393,7 +393,7 @@ def test_deny_overlap_one(q, bus, conn, stream, subscribe, stored, deny): Here's a tricker case: blocking a contact, and then removing them before the server's responded to the block request. """ - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") # As we saw in test_flickering(), we have a subscription to Bob, # everything's peachy. @@ -529,7 +529,7 @@ def test_deny_unblock_remove(q, bus, conn, stream, stored, deny): Test unblocking a contact, and, while that request is pending, deleting them. """ - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") # This contact was on our roster, blocked and subscribed, when we started. contact = 'music-is-math@boards.ca' diff --git a/tests/twisted/sasl/complex.py b/tests/twisted/sasl/complex.py index c290cd8..6b51bf4 100644 --- a/tests/twisted/sasl/complex.py +++ b/tests/twisted/sasl/complex.py @@ -108,7 +108,7 @@ def test_complex_success(q, bus, conn, stream, with_extra_data=True, args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) chan.Close() # ... and check that the Connection is still OK - conn.GetSelfHandle() + conn.Properties.Get(cs.CONN, "SelfHandle") def test_complex_success_data(q, bus, conn, stream): test_complex_success(q, bus, conn, stream, True) diff --git a/tests/twisted/test-debug.py b/tests/twisted/test-debug.py index d9c1818..9185342 100644 --- a/tests/twisted/test-debug.py +++ b/tests/twisted/test-debug.py @@ -38,7 +38,7 @@ def test(q, bus, conn, stream): debug.Properties.Set(iface, 'Enabled', True) channel_path = conn.RequestChannel( - cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, conn.GetSelfHandle(), True) + cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, conn.Properties.Get(cs.CONN, "SelfHandle"), True) q.expect_many( EventPattern ('dbus-signal', signal='NewChannel'), EventPattern ('dbus-signal', signal = 'NewDebugMessage')) @@ -56,7 +56,7 @@ def test(q, bus, conn, stream): q.expect('dbus-signal', signal='Closed') conn.RequestChannel( - cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, conn.GetSelfHandle(), True) + cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, conn.Properties.Get(cs.CONN, "SelfHandle"), True) q.expect('dbus-signal', signal='NewChannel') assertEquals (snapshot, messages) diff --git a/tests/twisted/text/destroy.py b/tests/twisted/text/destroy.py index f51a4c2..8c8c059 100644 --- a/tests/twisted/text/destroy.py +++ b/tests/twisted/text/destroy.py @@ -12,7 +12,7 @@ from servicetest import call_async, EventPattern import constants as cs def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jid = 'foo@bar.com' call_async(q, conn, 'RequestHandles', 1, [jid]) diff --git a/tests/twisted/text/ensure.py b/tests/twisted/text/ensure.py index e29906e..438a0c1 100644 --- a/tests/twisted/text/ensure.py +++ b/tests/twisted/text/ensure.py @@ -9,7 +9,7 @@ from servicetest import call_async, EventPattern import constants as cs def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jids = ['foo@bar.com', 'truc@cafe.fr'] call_async(q, conn, 'RequestHandles', 1, jids) diff --git a/tests/twisted/text/facebook-own-message.py b/tests/twisted/text/facebook-own-message.py index a695b3d..5aaa143 100644 --- a/tests/twisted/text/facebook-own-message.py +++ b/tests/twisted/text/facebook-own-message.py @@ -51,7 +51,7 @@ def test(q, bus, conn, stream): echo = header['delivery-echo'] echo_header, echo_body = echo - assertEquals(conn.GetSelfHandle(), echo_header['message-sender']) + assertEquals(conn.Properties.Get(cs.CONN, "SelfHandle"), echo_header['message-sender']) assertEquals('text/plain', echo_body['content-type']) assertEquals(text, echo_body['content']) diff --git a/tests/twisted/text/initiate-requestotron.py b/tests/twisted/text/initiate-requestotron.py index 9bd2b0a..d23ad07 100644 --- a/tests/twisted/text/initiate-requestotron.py +++ b/tests/twisted/text/initiate-requestotron.py @@ -10,7 +10,7 @@ from servicetest import (call_async, EventPattern, assertContains, import constants as cs def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jid = 'foo@bar.com' foo_handle = conn.RequestHandles(cs.HT_CONTACT, [jid])[0] diff --git a/tests/twisted/text/initiate.py b/tests/twisted/text/initiate.py index edf493c..9e817a6 100644 --- a/tests/twisted/text/initiate.py +++ b/tests/twisted/text/initiate.py @@ -11,7 +11,7 @@ from servicetest import call_async, EventPattern import constants as cs def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jid = 'foo@bar.com' call_async(q, conn, 'RequestHandles', cs.HT_CONTACT, [jid]) diff --git a/tests/twisted/text/respawn.py b/tests/twisted/text/respawn.py index 0ba4357..5a43b14 100644 --- a/tests/twisted/text/respawn.py +++ b/tests/twisted/text/respawn.py @@ -11,7 +11,7 @@ from servicetest import call_async, EventPattern, assertEquals import constants as cs def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jid = 'foo@bar.com' foo_handle = conn.RequestHandles(cs.HT_CONTACT, [jid])[0] diff --git a/tests/twisted/text/send-error.py b/tests/twisted/text/send-error.py index f330c0a..8a0f786 100644 --- a/tests/twisted/text/send-error.py +++ b/tests/twisted/text/send-error.py @@ -11,7 +11,7 @@ import constants as cs import ns def test_temporary_error(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jid = 'foo@bar.com' call_async(q, conn, 'RequestHandles', 1, [jid]) @@ -92,7 +92,7 @@ def test_temporary_error(q, bus, conn, stream): def test_permanent_error(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jid = 'wee@ninja.jp' call_async(q, conn, 'RequestHandles', 1, [jid]) diff --git a/tests/twisted/text/test-chat-state.py b/tests/twisted/text/test-chat-state.py index c129fb7..8d54658 100644 --- a/tests/twisted/text/test-chat-state.py +++ b/tests/twisted/text/test-chat-state.py @@ -38,7 +38,7 @@ def make_message(jid, body=None, state=None): return m def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") jid = 'foo@bar.com' full_jid = 'foo@bar.com/Foo' diff --git a/tests/twisted/text/test-text.py b/tests/twisted/text/test-text.py index a820e13..e7a7ddf 100644 --- a/tests/twisted/text/test-text.py +++ b/tests/twisted/text/test-text.py @@ -132,7 +132,7 @@ def test(q, bus, conn, stream): header = sent_message[0] assert header['message-type'] == 2, header # Notice assert header['message-token'] == sent_token, header - assertEquals(conn.GetSelfHandle(), header['message-sender']) + assertEquals(conn.Properties.Get(cs.CONN, "SelfHandle"), header['message-sender']) assertEquals('test@localhost', header['message-sender-id']) body = sent_message[1] assert body['content-type'] == 'text/plain', body diff --git a/tests/twisted/tubes/accept-private-dbus-tube.py b/tests/twisted/tubes/accept-private-dbus-tube.py index dbbeb3b..8122dac 100644 --- a/tests/twisted/tubes/accept-private-dbus-tube.py +++ b/tests/twisted/tubes/accept-private-dbus-tube.py @@ -37,7 +37,7 @@ def test(q, bus, conn, stream, bytestream_cls, access_control): query_name='vCard'), EventPattern('stream-iq', query_ns=ns.ROSTER)) - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") acknowledge_iq(stream, vcard_event.stanza) diff --git a/tests/twisted/tubes/offer-muc-dbus-tube.py b/tests/twisted/tubes/offer-muc-dbus-tube.py index 06ccc28..fa05c91 100644 --- a/tests/twisted/tubes/offer-muc-dbus-tube.py +++ b/tests/twisted/tubes/offer-muc-dbus-tube.py @@ -114,7 +114,7 @@ def test(q, bus, conn, stream, access_control): # check if we can request muc D-Bus tube t.check_conn_properties(q, conn) - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") self_name = conn.InspectHandles(1, [self_handle])[0] # offer a D-Bus tube to another room using new API diff --git a/tests/twisted/tubes/offer-private-dbus-tube.py b/tests/twisted/tubes/offer-private-dbus-tube.py index bb61eb2..2d5ecf5 100644 --- a/tests/twisted/tubes/offer-private-dbus-tube.py +++ b/tests/twisted/tubes/offer-private-dbus-tube.py @@ -202,7 +202,7 @@ def test(q, bus, conn, stream, bytestream_cls, access_control): t.check_conn_properties(q, conn) - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") alice_handle = conn.RequestHandles(cs.HT_CONTACT, ["alice@localhost"])[0] # send Alice's presence diff --git a/tests/twisted/tubes/offer-private-stream-tube.py b/tests/twisted/tubes/offer-private-stream-tube.py index de37041..e7652ec 100644 --- a/tests/twisted/tubes/offer-private-stream-tube.py +++ b/tests/twisted/tubes/offer-private-stream-tube.py @@ -51,7 +51,7 @@ def test(q, bus, conn, stream, bytestream_cls, query_name='vCard'), EventPattern('stream-iq', query_ns=ns.ROSTER)) - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") acknowledge_iq(stream, vcard_event.stanza) diff --git a/tests/twisted/tubes/tubetestutil.py b/tests/twisted/tubes/tubetestutil.py index 3eb86d9..9edf27b 100644 --- a/tests/twisted/tubes/tubetestutil.py +++ b/tests/twisted/tubes/tubetestutil.py @@ -181,7 +181,7 @@ def check_channel_properties(q, bus, conn, channel, channel_type, assert channel_props['TargetID'] == contact_id assert channel_props['Requested'] == True assert channel_props['InitiatorID'] == 'test@localhost' - assert channel_props['InitiatorHandle'] == conn.GetSelfHandle() + assert channel_props['InitiatorHandle'] == conn.Properties.Get(cs.CONN, "SelfHandle") if channel_type == cs.CHANNEL_TYPE_TUBES: assert state is None diff --git a/tests/twisted/vcard/overlapping-sets.py b/tests/twisted/vcard/overlapping-sets.py index a57ca9c..a656509 100644 --- a/tests/twisted/vcard/overlapping-sets.py +++ b/tests/twisted/vcard/overlapping-sets.py @@ -17,7 +17,7 @@ def test(q, bus, conn, stream): query_ns=ns.VCARD_TEMP, query_name='vCard') sync_stream(q, stream) - handle = conn.GetSelfHandle() + handle = conn.Properties.Get(cs.CONN, "SelfHandle") call_async(q, conn.Aliasing, 'SetAliases', {handle: 'Robert the Bruce'}) sync_dbus(bus, q, conn) acknowledge_iq(stream, vcard_get_event.stanza) diff --git a/tests/twisted/vcard/test-avatar-async.py b/tests/twisted/vcard/test-avatar-async.py index 423e9ff..cd4b9fd 100644 --- a/tests/twisted/vcard/test-avatar-async.py +++ b/tests/twisted/vcard/test-avatar-async.py @@ -48,7 +48,7 @@ def test(q, bus, conn, stream): # When we start, there is no avatar acknowledge_iq(stream, iq_event.stanza) - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") # Another resource confirms we have no avatar. We don't request our vCard # because we already know there is no avatar diff --git a/tests/twisted/vcard/test-set-alias.py b/tests/twisted/vcard/test-set-alias.py index 9545ef9..8d69d51 100644 --- a/tests/twisted/vcard/test-set-alias.py +++ b/tests/twisted/vcard/test-set-alias.py @@ -22,7 +22,7 @@ def validate_pep_update(pep_update, expected_nickname): assertLength(0, nick.children) def test(q, bus, conn, stream): - self_handle = conn.GetSelfHandle() + self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") conn.Aliasing.SetAliases({self_handle: 'lala'}) expect_and_handle_get_vcard(q, stream) diff --git a/tests/twisted/vcard/test-vcard-cache.py b/tests/twisted/vcard/test-vcard-cache.py index 083f5b5..4c28810 100644 --- a/tests/twisted/vcard/test-vcard-cache.py +++ b/tests/twisted/vcard/test-vcard-cache.py @@ -17,7 +17,7 @@ def test(q, bus, conn, stream): # Request our alias and avatar, expect them to be resolved from cache. - handle = conn.GetSelfHandle() + handle = conn.Properties.Get(cs.CONN, "SelfHandle") call_async(q, conn.Avatars, 'RequestAvatar', handle) call_async(q, conn.Aliasing, 'RequestAliases', [handle]) diff --git a/tests/twisted/vcard/test-vcard-race.py b/tests/twisted/vcard/test-vcard-race.py index 5ecd978..9fa61e6 100644 --- a/tests/twisted/vcard/test-vcard-race.py +++ b/tests/twisted/vcard/test-vcard-race.py @@ -18,6 +18,7 @@ from gabbletest import ( exec_test, expect_and_handle_get_vcard, expect_and_handle_set_vcard, make_result_iq, sync_stream) import ns +import constants as cs def test(q, bus, conn, stream): expect_and_handle_get_vcard(q, stream) @@ -27,7 +28,7 @@ def test(q, bus, conn, stream): # to reply and then set immediately. sync_stream(q, stream) - handle = conn.GetSelfHandle() + handle = conn.Properties.Get(cs.CONN, "SelfHandle") call_async(q, conn.Aliasing, 'SetAliases', {handle: 'Some Guy'}) diff --git a/tests/twisted/vcard/update-get-failed.py b/tests/twisted/vcard/update-get-failed.py index 225b70e..7580f25 100644 --- a/tests/twisted/vcard/update-get-failed.py +++ b/tests/twisted/vcard/update-get-failed.py @@ -17,7 +17,7 @@ def test(q, bus, conn, stream): # Force Gabble to process the vCard before calling any methods. sync_stream(q, stream) - handle = conn.GetSelfHandle() + handle = conn.Properties.Get(cs.CONN, "SelfHandle") call_async(q, conn.Avatars, 'SetAvatar', 'william shatner', 'image/x-actor-name') -- 1.8.4.rc3