[telepathy-gabble/master] add a test for overlapping vCard

Dafydd Harries dafydd.harries at collabora.co.uk
Thu Aug 6 12:01:34 PDT 2009


---
 tests/twisted/Makefile.am               |    1 +
 tests/twisted/vcard/overlapping-sets.py |   47 +++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100644 tests/twisted/vcard/overlapping-sets.py

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 0886d38..f8e51e8 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -71,6 +71,7 @@ TWISTED_TESTS = \
 	tubes/request-invalid-dbus-tube.py \
 	tubes/test-get-available-tubes.py \
 	tubes/test-socks5-muc.py \
+	vcard/overlapping-sets.py \
 	vcard/test-alias-empty-vcard.py \
 	vcard/test-alias-pep.py \
 	vcard/test-alias.py \
diff --git a/tests/twisted/vcard/overlapping-sets.py b/tests/twisted/vcard/overlapping-sets.py
new file mode 100644
index 0000000..79a8e79
--- /dev/null
+++ b/tests/twisted/vcard/overlapping-sets.py
@@ -0,0 +1,47 @@
+
+import base64
+
+from twisted.words.xish import xpath
+
+import constants as cs
+from servicetest import EventPattern, call_async, sync_dbus
+from gabbletest import (
+    acknowledge_iq, exec_test, expect_and_handle_get_vcard, make_result_iq,
+    sync_stream)
+import ns
+
+def test(q, bus, conn, stream):
+    conn.Connect()
+
+    # Initial vCard request. Respond only after we call SetAliases().
+    vcard_get_event = q.expect('stream-iq', iq_type='get', to=None,
+        query_ns=ns.VCARD_TEMP, query_name='vCard')
+    sync_stream(q, stream)
+
+    handle = conn.GetSelfHandle()
+    call_async(q, conn.Aliasing, 'SetAliases', {handle: 'Some Guy'})
+    sync_dbus(bus, q, conn)
+    acknowledge_iq(stream, vcard_get_event.stanza)
+
+    # Gabble sets a new vCard with our nickname.
+    vcard_set_event = q.expect('stream-iq', iq_type='set',
+        query_ns=ns.VCARD_TEMP, query_name='vCard')
+
+    # Before the server replies, the user sets their avatar.
+    call_async(q, conn.Avatars, 'SetAvatar', 'hello', 'image/png')
+    sync_dbus(bus, q, conn)
+    acknowledge_iq(stream, vcard_set_event.stanza)
+
+    vcard_set_event = q.expect('stream-iq', iq_type='set',
+        query_ns=ns.VCARD_TEMP, query_name='vCard')
+    acknowledge_iq(stream, vcard_set_event.stanza)
+    q.expect('dbus-return', method='SetAvatar')
+
+    # And then crashes.
+    sync_stream(q, stream)
+
+    conn.Disconnect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
+
+if __name__ == '__main__':
+    exec_test(test)
-- 
1.5.6.5




More information about the telepathy-commits mailing list