[next] telepathy-haze: Don' t try to get Protocol properties if unimplemented

Simon McVittie smcv at kemper.freedesktop.org
Wed May 7 02:18:33 PDT 2014


Module: telepathy-haze
Branch: next
Commit: 4545ae0459e4ae7a0de329918ac507c56a050f37
URL:    http://cgit.freedesktop.org/telepathy/telepathy-haze/commit/?id=4545ae0459e4ae7a0de329918ac507c56a050f37

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Apr 22 14:22:31 2014 +0100

Don't try to get Protocol properties if unimplemented

Under dbus-glib, the object secretly implemented all the interfaces
for which we had code, even if its Interfaces property indicated
otherwise. Under GDBus, the two are linked.

---

 tests/twisted/cm/protocols.py |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tests/twisted/cm/protocols.py b/tests/twisted/cm/protocols.py
index 9492f8c..5f2d60f 100644
--- a/tests/twisted/cm/protocols.py
+++ b/tests/twisted/cm/protocols.py
@@ -24,14 +24,16 @@ def test(q, bus, conn, stream):
         protocol_iface = dbus.Interface(protocol, cs.PROTOCOL)
         protocol_props = dbus.Interface(protocol, cs.PROPERTIES_IFACE)
         flat_props = protocol_props.GetAll(cs.PROTOCOL)
-        protocol_avatar_props = protocol_props.GetAll(cs.PROTOCOL_IFACE_AVATARS)
 
         # Protocol is supposed to implement Interface.Avatars iff the
         # connection implements Avatars as well.
         if cs.CONN_IFACE_AVATARS in flat_props['ConnectionInterfaces']:
             assertContains(cs.PROTOCOL_IFACE_AVATARS, props[cs.PROTOCOL + '.Interfaces'])
+            protocol_avatar_props = (
+                protocol_props.GetAll(cs.PROTOCOL_IFACE_AVATARS))
         else:
             assertDoesNotContain(cs.PROTOCOL_IFACE_AVATARS, props[cs.PROTOCOL + '.Interfaces'])
+            protocol_avatar_props = None
 
         parameters = props[cs.PROTOCOL + '.Parameters']
         assertEquals(parameters, flat_props['Parameters'])
@@ -104,14 +106,7 @@ def test(q, bus, conn, stream):
             assertDoesNotContain(cs.CONN_IFACE_MAIL_NOTIFICATION, flat_props['ConnectionInterfaces'])
 
             # Avatar not supported
-            assertEquals(0, protocol_avatar_props['MaximumAvatarBytes'])
-            assertEquals(0, protocol_avatar_props['MaximumAvatarHeight'])
-            assertEquals(0, protocol_avatar_props['MaximumAvatarWidth'])
-            assertEquals(0, protocol_avatar_props['MinimumAvatarHeight'])
-            assertEquals(0, protocol_avatar_props['MinimumAvatarWidth'])
-            assertEquals(0, protocol_avatar_props['RecommendedAvatarHeight'])
-            assertEquals(0, protocol_avatar_props['RecommendedAvatarWidth'])
-            assertEquals([], protocol_avatar_props['SupportedAvatarMIMETypes'])
+            assertEquals(None, protocol_avatar_props)
         elif name == 'myspace':
             assertEquals('x-myspace', flat_props['VCardField'])
             assertEquals('im-myspace', flat_props['Icon'])



More information about the telepathy-commits mailing list