summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-11-29 12:25:10 (GMT)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-12-01 10:39:42 (GMT)
commit7e15a142431f40b18c5e6edbccc569eb7e0ac178 (patch)
treee843edfde29ed03f34fe72d625f9ca9e7885d37a /tests
parenta4a52af0ff20290a39992ae77522495eb6de677a (diff)
downloadtelepathy-haze-7e15a142431f40b18c5e6edbccc569eb7e0ac178.tar.gz
telepathy-haze-7e15a142431f40b18c5e6edbccc569eb7e0ac178.tar.xz
Add a 'stored' list (which just behaves like 'subscribe') and test it
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/roster/initial-roster.py23
-rw-r--r--tests/twisted/roster/publish.py21
-rw-r--r--tests/twisted/roster/removed-from-rp-subscribe.py30
3 files changed, 51 insertions, 23 deletions
diff --git a/tests/twisted/roster/initial-roster.py b/tests/twisted/roster/initial-roster.py
index c73fb1a..61b4731 100644
--- a/tests/twisted/roster/initial-roster.py
+++ b/tests/twisted/roster/initial-roster.py
@@ -50,18 +50,17 @@ def test(q, bus, conn, stream):
q.expect('dbus-signal', signal='StatusChanged',
args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
- # there is no 'stored' yet; when it exists, it should have Amy, Bob and
- # Chris
- #call_async(q, conn.Requests, 'EnsureChannel',{
- # cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
- # cs.TARGET_HANDLE_TYPE: cs.HT_LIST,
- # cs.TARGET_ID: 'stored',
- # })
- #e = q.expect('dbus-return', method='EnsureChannel')
- #stored = wrap_channel(bus.get_object(conn.bus_name, e.value[1]),
- # cs.CHANNEL_TYPE_CONTACT_LIST)
- #jids = set(conn.InspectHandles(cs.HT_CONTACT, stored.Group.GetMembers()))
- #assertEquals(set(['amy@foo.com', 'bob@foo.com', 'chris@foo.com']), jids)
+ # Amy, Bob and Chris are all stored on our server-side roster
+ call_async(q, conn.Requests, 'EnsureChannel',{
+ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
+ cs.TARGET_HANDLE_TYPE: cs.HT_LIST,
+ cs.TARGET_ID: 'stored',
+ })
+ e = q.expect('dbus-return', method='EnsureChannel')
+ stored = wrap_channel(bus.get_object(conn.bus_name, e.value[1]),
+ cs.CHANNEL_TYPE_CONTACT_LIST)
+ jids = set(conn.InspectHandles(cs.HT_CONTACT, stored.Group.GetMembers()))
+ assertEquals(set(['amy@foo.com', 'bob@foo.com', 'chris@foo.com']), jids)
call_async(q, conn.Requests, 'EnsureChannel',{
cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
diff --git a/tests/twisted/roster/publish.py b/tests/twisted/roster/publish.py
index 60e7a49..b78425e 100644
--- a/tests/twisted/roster/publish.py
+++ b/tests/twisted/roster/publish.py
@@ -32,6 +32,17 @@ def test(q, bus, conn, stream):
call_async(q, conn.Requests, 'EnsureChannel',{
cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
cs.TARGET_HANDLE_TYPE: cs.HT_LIST,
+ cs.TARGET_ID: 'stored',
+ })
+ e = q.expect('dbus-return', method='EnsureChannel')
+ stored = wrap_channel(bus.get_object(conn.bus_name, e.value[1]),
+ cs.CHANNEL_TYPE_CONTACT_LIST)
+ jids = set(conn.InspectHandles(cs.HT_CONTACT, stored.Group.GetMembers()))
+ assertEquals(set(), jids)
+
+ call_async(q, conn.Requests, 'EnsureChannel',{
+ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
+ cs.TARGET_HANDLE_TYPE: cs.HT_LIST,
cs.TARGET_ID: 'subscribe',
})
e = q.expect('dbus-return', method='EnsureChannel')
@@ -77,11 +88,15 @@ def test(q, bus, conn, stream):
stream.send(iq)
- _, _, new_group = q.expect_many(
+ _, _, _, new_group = q.expect_many(
EventPattern('stream-iq', iq_type='result',
predicate=lambda e: e.stanza['id'] == 'roster-push'),
- # this isn't really true, but it's the closest we can guess from
- # libpurple
+ # Alice is genuinely on our server-side roster
+ EventPattern('dbus-signal', signal='MembersChanged',
+ path=stored.object_path,
+ args=['', [alice], [], [], [], 0, cs.GC_REASON_NONE]),
+ # She's not really on our subscribe list, but this is the closest
+ # we can guess from libpurple
EventPattern('dbus-signal', signal='MembersChanged',
path=subscribe.object_path,
args=['', [alice], [], [], [], 0, cs.GC_REASON_NONE]),
diff --git a/tests/twisted/roster/removed-from-rp-subscribe.py b/tests/twisted/roster/removed-from-rp-subscribe.py
index a399063..db1133b 100644
--- a/tests/twisted/roster/removed-from-rp-subscribe.py
+++ b/tests/twisted/roster/removed-from-rp-subscribe.py
@@ -29,6 +29,15 @@ def test(q, bus, conn, stream, remove, local):
call_async(q, conn.Requests, 'EnsureChannel',{
cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
cs.TARGET_HANDLE_TYPE: cs.HT_LIST,
+ cs.TARGET_ID: 'stored',
+ })
+ e = q.expect('dbus-return', method='EnsureChannel')
+ stored = wrap_channel(bus.get_object(conn.bus_name, e.value[1]),
+ cs.CHANNEL_TYPE_CONTACT_LIST)
+
+ call_async(q, conn.Requests, 'EnsureChannel',{
+ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
+ cs.TARGET_HANDLE_TYPE: cs.HT_LIST,
cs.TARGET_ID: 'publish',
})
e = q.expect('dbus-return', method='EnsureChannel')
@@ -58,9 +67,13 @@ def test(q, bus, conn, stream, remove, local):
stream.send(iq)
# In response, Haze adds Marco to the roster, which we guess (wrongly,
- # in this case) means subscribe
- q.expect('dbus-signal', signal='MembersChanged',
- args=['', [h], [], [], [], 0, 0], path=subscribe.object_path)
+ # in this case) also means subscribe
+ q.expect_many(
+ EventPattern('dbus-signal', signal='MembersChanged',
+ args=['', [h], [], [], [], 0, 0], path=subscribe.object_path),
+ EventPattern('dbus-signal', signal='MembersChanged',
+ args=['', [h], [], [], [], 0, 0], path=stored.object_path),
+ )
# Gajim sends a <presence type='subscribe'/> to Marco. 'As a result, the
# user's server MUST initiate a second roster push to all of the user's
@@ -81,9 +94,8 @@ def test(q, bus, conn, stream, remove, local):
if remove:
# ...removes him from the roster...
if local:
- # ...by telling Haze to remove him from subscribe (which is
- # really more like stored)
- subscribe.Group.RemoveMembers([h], '')
+ # ...by telling Haze to remove him from stored
+ stored.Group.RemoveMembers([h], '')
event = q.expect('stream-iq', iq_type='set', query_ns=ns.ROSTER)
item = event.query.firstChildElement()
@@ -107,12 +119,14 @@ def test(q, bus, conn, stream, remove, local):
stream.send(iq)
# In response, Haze should announce that Marco has been removed from
- # subscribe:remote-pending and stored:members: but it has no stored
- # channel.
+ # subscribe:remote-pending and stored:members
q.expect_many(
EventPattern('dbus-signal', signal='MembersChanged',
args=['', [], [h], [], [], 0, 0],
path=subscribe.object_path),
+ EventPattern('dbus-signal', signal='MembersChanged',
+ args=['', [], [h], [], [], 0, 0],
+ path=stored.object_path),
)
else:
# ...rescinds the subscription request...