[telepathy-gabble/telepathy-gabble-0.8] test-avatar-async.py: coding style and use assertEquals, as per Daf review

Alban Crequy alban.crequy at collabora.co.uk
Fri Sep 25 10:02:47 PDT 2009


---
 tests/twisted/vcard/test-avatar-async.py |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/tests/twisted/vcard/test-avatar-async.py b/tests/twisted/vcard/test-avatar-async.py
index e97a52a..05c3a88 100644
--- a/tests/twisted/vcard/test-avatar-async.py
+++ b/tests/twisted/vcard/test-avatar-async.py
@@ -7,14 +7,13 @@ import base64
 import hashlib
 
 from twisted.words.xish import domish
-from servicetest import EventPattern, sync_dbus
+from servicetest import EventPattern, sync_dbus, assertEquals
 from gabbletest import (exec_test, acknowledge_iq, make_result_iq, 
     sync_stream, send_error_reply)
 import constants as cs
 import ns
 
-avatar_retrieved_event = EventPattern('dbus-signal',
-        signal='AvatarRetrieved')
+avatar_retrieved_event = EventPattern('dbus-signal', signal='AvatarRetrieved')
 avatar_request_event = EventPattern('stream-iq', query_ns='vcard-temp')
 
 def test_get_avatar(q, bus, conn, stream, contact, handle, in_cache=False):
@@ -33,10 +32,10 @@ def test_get_avatar(q, bus, conn, stream, contact, handle, in_cache=False):
         stream.send(iq)
 
     event = q.expect('dbus-signal', signal='AvatarRetrieved')
-    assert event.args[0] == handle
-    assert event.args[1] == hashlib.sha1('hello').hexdigest()
-    assert event.args[2] == 'hello'
-    assert event.args[3] == 'image/png'
+    assertEquals(handle, event.args[0])
+    assertEquals(hashlib.sha1('hello').hexdigest(), event.args[1])
+    assertEquals('hello', event.args[2])
+    assertEquals('image/png', event.args[3])
 
     if in_cache:
         sync_stream(q, stream)
@@ -108,10 +107,10 @@ def test(q, bus, conn, stream):
     stream.send(iq)
 
     event = q.expect('dbus-signal', signal='AvatarRetrieved')
-    assert event.args[0] == busy_handle
-    assert event.args[1] == hashlib.sha1('hello').hexdigest()
-    assert event.args[2] == 'hello'
-    assert event.args[3] == 'image/png'
+    assertEquals(busy_handle, event.args[0])
+    assertEquals(hashlib.sha1('hello').hexdigest(), event.args[1])
+    assertEquals('hello', event.args[2])
+    assertEquals('image/png', event.args[3])
 
 if __name__ == '__main__':
     exec_test(test)
-- 
1.5.6.5




More information about the telepathy-commits mailing list