[telepathy-gabble/master] test-avatar-async.py: Do not loop when there is no avatar
Alban Crequy
alban.crequy at collabora.co.uk
Thu Oct 8 03:56:19 PDT 2009
---
tests/twisted/vcard/test-avatar-async.py | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/tests/twisted/vcard/test-avatar-async.py b/tests/twisted/vcard/test-avatar-async.py
index f288eaa..9dbf88f 100644
--- a/tests/twisted/vcard/test-avatar-async.py
+++ b/tests/twisted/vcard/test-avatar-async.py
@@ -49,7 +49,24 @@ def test(q, bus, conn, stream):
EventPattern('stream-iq', to=None, query_ns='vcard-temp',
query_name='vCard'))
+ # When we start, there is no avatar
acknowledge_iq(stream, iq_event.stanza)
+ self_handle = conn.GetSelfHandle()
+
+ # Another resource confirms we have no avatar. We don't request our vCard
+ # because we already know there is no avatar
+ presence_stanza = make_presence('test at localhost/noavatar',
+ to='test at localhost/Resource',
+ show='away', status='At the pub',
+ photo="")
+ q.forbid_events([avatar_request_event, avatar_retrieved_event])
+ # Gabble must resist temptation to send vCard requests even with several
+ # presence stanza sent!
+ stream.send(presence_stanza)
+ stream.send(presence_stanza)
+ sync_stream(q, stream) # Twice because the vCard request is done in
+ sync_stream(q, stream) # g_idle_add
+ q.unforbid_events([avatar_request_event, avatar_retrieved_event])
# Request on the first contact. Test the cache.
handle = conn.RequestHandles(1, ['bob at foo.com'])[0]
@@ -113,7 +130,6 @@ def test(q, bus, conn, stream):
assertEquals('image/png', event.args[3])
# Test with our own avatar test at localhost/Resource2
- self_handle = conn.GetSelfHandle()
presence_stanza = make_presence('test at localhost/Resource2',
to='test at localhost/Resource',
show='away', status='At the pub',
--
1.5.6.5
More information about the telepathy-commits
mailing list