[telepathy-gabble/master] test-avatar-async.py: Regression test for item->timer_id != 0

Alban Crequy alban.crequy at collabora.co.uk
Thu Oct 8 07:41:51 PDT 2009


See this crash:
https://bugs.edge.launchpad.net/ubuntu/+source/telepathy-gabble/+bug/445847
---
 tests/twisted/vcard/test-avatar-async.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/vcard/test-avatar-async.py b/tests/twisted/vcard/test-avatar-async.py
index 9dbf88f..7daff94 100644
--- a/tests/twisted/vcard/test-avatar-async.py
+++ b/tests/twisted/vcard/test-avatar-async.py
@@ -12,6 +12,7 @@ from gabbletest import (exec_test, acknowledge_iq, make_result_iq,
     sync_stream, send_error_reply, make_presence)
 import constants as cs
 import ns
+import dbus
 
 avatar_retrieved_event = EventPattern('dbus-signal', signal='AvatarRetrieved')
 avatar_request_event = EventPattern('stream-iq', query_ns='vcard-temp')
@@ -183,5 +184,17 @@ def test(q, bus, conn, stream):
     assertEquals('hello', data)
     q.unforbid_events([avatar_request_event])
 
+    # if the server don't reply after the timeout and there is pending
+    # requests, Gabble must handle that correctly and not crash.
+    contacts = ['random_user_%s at bigserver.com' % i for i in range(1, 100) ]
+    handles = [conn.RequestHandles(1, [contact])[0] for contact in contacts]
+    conn.Avatars.RequestAvatars(handles)
+    try:
+        conn.Avatars.RequestAvatar(handles[-1])
+    except dbus.DBusException, e:
+        assertEquals(cs.NOT_AVAILABLE, e.get_dbus_name())
+    else:
+        assert False
+
 if __name__ == '__main__':
     exec_test(test)
-- 
1.5.6.5




More information about the telepathy-commits mailing list