[next] telepathy-haze: Don't assert that GetAll(Avatars1) will work before Connected

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


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

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

Don't assert that GetAll(Avatars1) will work before Connected

It's conditional now.

---

 tests/twisted/avatar-requirements.py |   43 ++++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/tests/twisted/avatar-requirements.py b/tests/twisted/avatar-requirements.py
index 83d155e..a4b59b4 100644
--- a/tests/twisted/avatar-requirements.py
+++ b/tests/twisted/avatar-requirements.py
@@ -1,27 +1,34 @@
-from servicetest import call_async, EventPattern
+from dbus import (DBusException)
+
+from servicetest import (call_async, EventPattern, assertContains)
 from hazetest import exec_test
 import constants as cs
 
 def test(q, bus, conn, stream):
-    props = conn.GetAll(cs.CONN_IFACE_AVATARS,
+    try:
+        props = conn.GetAll(cs.CONN_IFACE_AVATARS,
             dbus_interface=cs.PROPERTIES_IFACE)
-    types = props['SupportedAvatarMIMETypes']
-    minw = props['MinimumAvatarWidth']
-    minh = props['MinimumAvatarHeight']
-    maxw = props['MaximumAvatarWidth']
-    maxh = props['MaximumAvatarHeight']
-    maxb = props['MaximumAvatarBytes']
-    rech = props['RecommendedAvatarHeight']
-    recw = props['RecommendedAvatarWidth']
+    except DBusException, e:
+        assertContains(e.get_dbus_name(),
+                ['org.freedesktop.DBus.Error.InvalidArgs'])
+    else:
+        types = props['SupportedAvatarMIMETypes']
+        minw = props['MinimumAvatarWidth']
+        minh = props['MinimumAvatarHeight']
+        maxw = props['MaximumAvatarWidth']
+        maxh = props['MaximumAvatarHeight']
+        maxb = props['MaximumAvatarBytes']
+        rech = props['RecommendedAvatarHeight']
+        recw = props['RecommendedAvatarWidth']
 
-    assert types == [], types
-    assert minw == 0, minw
-    assert minh == 0, minh
-    assert maxw == 0, maxw
-    assert maxh == 0, maxh
-    assert maxb == 0, maxb
-    assert recw == 0, recw
-    assert rech == 0, rech
+        assert types == [], types
+        assert minw == 0, minw
+        assert minh == 0, minh
+        assert maxw == 0, maxw
+        assert maxh == 0, maxh
+        assert maxb == 0, maxb
+        assert recw == 0, recw
+        assert rech == 0, rech
 
     conn.Connect()
     q.expect('dbus-signal', signal='StatusChanged',



More information about the telepathy-commits mailing list