From a2eebf902fa025020ede953b68d683a7b2cf69eb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 2 Oct 2013 19:35:39 +0100 Subject: [PATCH 07/22] tests: replace SimplePresence with Presence --- tests/keyfile.c | 2 +- tests/twisted/account-manager/auto-connect.py | 2 +- tests/twisted/account-manager/make-valid.py | 4 ++-- tests/twisted/account-manager/presence.py | 12 +++++----- .../account-manager/recover-from-disconnect.py | 4 ++-- tests/twisted/account-manager/request-online.py | 2 +- tests/twisted/dispatcher/connect-for-request.py | 4 ++-- tests/twisted/mctest.py | 26 +++++++++++----------- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/keyfile.c b/tests/keyfile.c index 93188ee..cba4c00 100644 --- a/tests/keyfile.c +++ b/tests/keyfile.c @@ -303,7 +303,7 @@ test_uss (void) GError *error = NULL; GValueArray *unescaped_va; - g_value_init (&unescaped, TP_STRUCT_TYPE_SIMPLE_PRESENCE); + g_value_init (&unescaped, TP_STRUCT_TYPE_PRESENCE); success = mcd_keyfile_unescape_value ("2;available;\\;;", &unescaped, &error); diff --git a/tests/twisted/account-manager/auto-connect.py b/tests/twisted/account-manager/auto-connect.py index c8b9184..a05f2c9 100644 --- a/tests/twisted/account-manager/auto-connect.py +++ b/tests/twisted/account-manager/auto-connect.py @@ -164,7 +164,7 @@ def test(q, bus, unused, **kwargs): args=[{ conn.self_handle: 'JC' }], handled=False), EventPattern('dbus-method-call', path=conn.object_path, - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence', + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', handled=True), EventPattern('dbus-method-call', interface=cs.CONN_IFACE_AVATARS, method='SetAvatar', diff --git a/tests/twisted/account-manager/make-valid.py b/tests/twisted/account-manager/make-valid.py index 14abcee..2f7c1f8 100644 --- a/tests/twisted/account-manager/make-valid.py +++ b/tests/twisted/account-manager/make-valid.py @@ -173,7 +173,7 @@ def test(q, bus, unused, **kwargs): set_presence, e = q.expect_many( EventPattern('dbus-method-call', path=conn.object_path, - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence', + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', handled=True), EventPattern('dbus-signal', signal='AccountPropertyChanged', path=account_path, interface=cs.ACCOUNT, @@ -224,7 +224,7 @@ def test(q, bus, unused, **kwargs): conn.StatusChanged(cs.CONN_STATUS_CONNECTED, cs.CSR_NONE_SPECIFIED) set_presence = q.expect('dbus-method-call', path=conn.object_path, - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence', + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', handled=True) e = q.expect('dbus-signal', signal='AccountPropertyChanged', diff --git a/tests/twisted/account-manager/presence.py b/tests/twisted/account-manager/presence.py index 4034593..cc7523b 100755 --- a/tests/twisted/account-manager/presence.py +++ b/tests/twisted/account-manager/presence.py @@ -84,11 +84,11 @@ def test(q, bus, mc): predicate=(lambda e: log.append('Get(Interfaces)') or True)), EventPattern('dbus-method-call', interface=cs.PROPERTIES_IFACE, method='Get', - args=[cs.CONN_IFACE_SIMPLE_PRESENCE, 'Statuses'], + args=[cs.CONN_IFACE_PRESENCE, 'Statuses'], handled=True, predicate=(lambda e: log.append('Get(Statuses)[1]') or True)), EventPattern('dbus-method-call', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', args=list(presence[1:]), handled=True, @@ -97,11 +97,11 @@ def test(q, bus, mc): expect_after_connect=[ EventPattern('dbus-method-call', interface=cs.PROPERTIES_IFACE, method='Get', - args=[cs.CONN_IFACE_SIMPLE_PRESENCE, 'Statuses'], + args=[cs.CONN_IFACE_PRESENCE, 'Statuses'], handled=True, predicate=(lambda e: log.append('Get(Statuses)[2]') or True)), EventPattern('dbus-method-call', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', args=list(presence[1:]), handled=True, @@ -129,7 +129,7 @@ def test(q, bus, mc): e, _, _ = q.expect_many( EventPattern('dbus-method-call', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence', + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', args=list(presence[1:]), handled=True), EventPattern('dbus-signal', path=account.object_path, @@ -157,7 +157,7 @@ def test(q, bus, mc): presence) e = q.expect('dbus-method-call', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence', + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', args=list(presence[1:]), handled=True) diff --git a/tests/twisted/account-manager/recover-from-disconnect.py b/tests/twisted/account-manager/recover-from-disconnect.py index 186d13d..082fe12 100644 --- a/tests/twisted/account-manager/recover-from-disconnect.py +++ b/tests/twisted/account-manager/recover-from-disconnect.py @@ -64,7 +64,7 @@ def test(q, bus, mc): conn.StatusChanged(cs.CONN_STATUS_CONNECTED, cs.CSR_NONE_SPECIFIED) q.expect('dbus-method-call', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', args=list(presence[1:]), handled=True) @@ -169,7 +169,7 @@ def test(q, bus, mc): cs.CONN_STATUS_CONNECTED), ), EventPattern('dbus-method-call', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', args=list(presence[1:]), handled=True), diff --git a/tests/twisted/account-manager/request-online.py b/tests/twisted/account-manager/request-online.py index 08d0248..2503219 100644 --- a/tests/twisted/account-manager/request-online.py +++ b/tests/twisted/account-manager/request-online.py @@ -128,7 +128,7 @@ def test(q, bus, mc): assert properties.get('HasBeenOnline') assertEquals(requested_presence, properties.get('RequestedPresence')) - # Since this Connection doesn't support SimplePresence, but it's online, + # Since this Connection doesn't support Presence, but it's online, # the spec says that CurrentPresence should be Unset. assertEquals((cs.PRESENCE_UNSET, "", ""), properties.get('CurrentPresence')) diff --git a/tests/twisted/dispatcher/connect-for-request.py b/tests/twisted/dispatcher/connect-for-request.py index 1163752..6bb8e96 100644 --- a/tests/twisted/dispatcher/connect-for-request.py +++ b/tests/twisted/dispatcher/connect-for-request.py @@ -114,14 +114,14 @@ def test(q, bus, mc): _, cm_request_call = q.expect_many( EventPattern('dbus-method-call', path=conn.object_path, - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence', + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence', args=['busy', 'Testing automatic presence'], handled=True), EventPattern('dbus-method-call', path=conn.object_path, interface=cs.CONN_IFACE_REQUESTS, method='CreateChannel', args=[request], handled=False), ) - q.dbus_emit(conn.object_path, cs.CONN_IFACE_SIMPLE_PRESENCE, + q.dbus_emit(conn.object_path, cs.CONN_IFACE_PRESENCE, 'PresencesChanged', {conn.self_handle: (dbus.UInt32(cs.PRESENCE_BUSY), 'busy', 'Testing automatic presence')}, diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py index 2b7809e..fe774c9 100644 --- a/tests/twisted/mctest.py +++ b/tests/twisted/mctest.py @@ -265,7 +265,7 @@ class SimulatedConnection(object): if self.has_avatars: self.interfaces.append(cs.CONN_IFACE_AVATARS) if self.has_presence: - self.interfaces.append(cs.CONN_IFACE_SIMPLE_PRESENCE) + self.interfaces.append(cs.CONN_IFACE_PRESENCE) if self.extra_interfaces: self.interfaces.extend(self.extra_interfaces) @@ -337,19 +337,19 @@ class SimulatedConnection(object): if has_presence: q.add_dbus_method_impl(self.SetPresence, path=self.object_path, - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, method='SetPresence') q.add_dbus_method_impl(self.GetPresences, path=self.object_path, - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, method='GetPresences') - q.add_dbus_method_impl(self.Get_SimplePresenceStatuses, + q.add_dbus_method_impl(self.Get_PresenceStatuses, path=self.object_path, interface=cs.PROPERTIES_IFACE, method='Get', - args=[cs.CONN_IFACE_SIMPLE_PRESENCE, 'Statuses']) - q.add_dbus_method_impl(self.GetAll_SimplePresence, + args=[cs.CONN_IFACE_PRESENCE, 'Statuses']) + q.add_dbus_method_impl(self.GetAll_Presence, path=self.object_path, interface=cs.PROPERTIES_IFACE, method='GetAll', - args=[cs.CONN_IFACE_SIMPLE_PRESENCE]) + args=[cs.CONN_IFACE_PRESENCE]) if has_aliasing: q.add_dbus_method_impl(self.GetAliasFlags, @@ -516,7 +516,7 @@ class SimulatedConnection(object): self.presence = presence self.q.dbus_emit(self.object_path, - cs.CONN_IFACE_SIMPLE_PRESENCE, 'PresencesChanged', + cs.CONN_IFACE_PRESENCE, 'PresencesChanged', { self.self_handle : presence }, signature='a{u(uss)}') @@ -524,10 +524,10 @@ class SimulatedConnection(object): else: self.q.dbus_raise(cs.INVALID_ARGUMENT, 'Unknown status') - def Get_SimplePresenceStatuses(self, e): + def Get_PresenceStatuses(self, e): self.q.dbus_return(e.message, self.statuses, signature='v') - def GetAll_SimplePresence(self, e): + def GetAll_Presence(self, e): self.q.dbus_return(e.message, {'Statuses': self.statuses}, signature='a{sv}') @@ -597,7 +597,7 @@ class SimulatedConnection(object): 'available', ''), signature='uss') self.q.dbus_emit(self.object_path, - cs.CONN_IFACE_SIMPLE_PRESENCE, 'PresencesChanged', + cs.CONN_IFACE_PRESENCE, 'PresencesChanged', { self.self_handle : self.presence }, signature='a{u(uss)}') @@ -679,7 +679,7 @@ class SimulatedConnection(object): # token yet, we don't wait. ret[cs.ATTR_AVATAR_TOKEN] = str(self.avatar[0]) - if cs.CONN_IFACE_SIMPLE_PRESENCE in ifaces: + if cs.CONN_IFACE_PRESENCE in ifaces: if h == self.self_handle: ret[cs.ATTR_PRESENCE] = self.presence else: @@ -695,7 +695,7 @@ class SimulatedConnection(object): return set(self.interfaces).intersection(set([ cs.CONN_IFACE_ALIASING, cs.CONN_IFACE_AVATARS, - cs.CONN_IFACE_SIMPLE_PRESENCE, + cs.CONN_IFACE_PRESENCE, ])) def GetContactAttributes(self, e): -- 1.8.4.rc3