[telepathy-gabble/telepathy-gabble-0.8] set-set-disconnect.py: fix race when setting the avatar

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Tue Dec 8 05:52:32 PST 2009


Test was relying on the ordering of the vCard IQ reply and the D-Bus
method call. Ensure that the first vCard reply has been received by
Gabble and then wait for the second vCard query once we have
called the SetAvatar method.
---
 tests/twisted/vcard/set-set-disconnect.py |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/tests/twisted/vcard/set-set-disconnect.py b/tests/twisted/vcard/set-set-disconnect.py
index cd2d295..1b54005 100644
--- a/tests/twisted/vcard/set-set-disconnect.py
+++ b/tests/twisted/vcard/set-set-disconnect.py
@@ -4,21 +4,18 @@ Regression test for crash when disconnecting in the middle of a set.
 """
 
 from servicetest import EventPattern, call_async, sync_dbus
-from gabbletest import exec_test, acknowledge_iq
+from gabbletest import exec_test, acknowledge_iq, expect_and_handle_get_vcard, sync_stream
 import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
-    _, iq_event = q.expect_many(
-        EventPattern('dbus-signal', signal='StatusChanged',
-            args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]),
-        EventPattern('stream-iq', to=None, query_ns='vcard-temp',
-            query_name='vCard'))
 
-    acknowledge_iq(stream, iq_event.stanza)
+    expect_and_handle_get_vcard(q, stream)
+    sync_stream(q, stream)
 
     call_async(
         q, conn.Avatars, 'SetAvatar', 'Guy.brush', 'image/x-mighty-pirate')
+    expect_and_handle_get_vcard(q, stream)
     iq_event = q.expect(
         'stream-iq', iq_type='set', query_ns='vcard-temp', query_name='vCard')
     call_async(
-- 
1.5.6.5



More information about the telepathy-commits mailing list