summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-01-20 10:32:23 +0000
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-01-20 10:32:23 +0000
commit3480cc208e90145dd25e9b1dcaf1bab1d62fb5f8 (patch)
treecddf5387c27368e461329d2d5402c4f3bb8c9d86
parent4fe5ceb3450aef8539bde3f65f1574ecb8e8e351 (diff)
client-types.py: add another test for fd.o#32139client-types
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--tests/twisted/client-types.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/twisted/client-types.py b/tests/twisted/client-types.py
index 50bc33580..608322cbc 100644
--- a/tests/twisted/client-types.py
+++ b/tests/twisted/client-types.py
@@ -3,7 +3,7 @@ Test Conn.I.ClientTypes
"""
import random
-from servicetest import EventPattern, assertEquals, assertLength, assertContains
+from servicetest import EventPattern, assertEquals, assertLength, assertContains, assertSameSets
from gabbletest import exec_test, make_presence, sync_stream
import constants as cs
import ns
@@ -195,5 +195,42 @@ def test(q, bus, conn, stream):
# longer in the presence cache. So we sync here to check if it's died.
sync_stream(q, stream)
+def test2(q, bus, conn, stream):
+ marco_pidgin = 'marco@fancy.italian.restaurant/Pidgin'
+ marco_phone = 'marco@fancy.italian.restaurant/N900'
+ handle = conn.RequestHandles(cs.HT_CONTACT, [marco_pidgin])[0]
+
+ # pidgin comes online
+ contact_online(q, conn, stream, marco_pidgin, PC)
+
+ types = conn.GetClientTypes([handle],
+ dbus_interface=cs.CONN_IFACE_CLIENT_TYPES)
+ assertSameSets(['pc'], types[handle])
+
+ # phone comes online
+ contact_online(q, conn, stream, marco_phone, PHONE, initial=False)
+
+ types = conn.GetClientTypes([handle],
+ dbus_interface=cs.CONN_IFACE_CLIENT_TYPES)
+ assertSameSets(['pc'], types[handle])
+
+ sync_stream(q, stream)
+
+ # pidgin goes offline
+ stream.send(make_presence(marco_pidgin, type='unavailable'))
+
+ # no presence signal
+
+ q.expect('dbus-signal', signal='ClientTypesUpdated',
+ args=[handle, ['phone']])
+
+ # pidgin comes back online
+ caps, _, _ = build_stuff(PC)
+ stream.send(make_presence(marco_pidgin, status='hello', caps=caps))
+
+ q.expect('dbus-signal', signal='ClientTypesUpdated',
+ args=[handle, ['pc']])
+
if __name__ == '__main__':
exec_test(test)
+ exec_test(test2)