summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-11-30 17:56:18 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-12-01 10:39:49 +0000
commit404a7b02b61a86d8f8b0836069cfe8dacdf27b34 (patch)
treedbfc25503a020c0bf1a1515217bf8d35e5df2417 /tests
parent5c395b47ac277179fafb153340656598c7348bf8 (diff)
downloadtelepathy-haze-404a7b02b61a86d8f8b0836069cfe8dacdf27b34.tar.gz
Use the TpBaseContactList
This requires some changes in the tests: * the actor that's assumed for some group changes now differs * anyone who sends us a publication request appears in the 'stored' list
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/roster/groups.py11
-rw-r--r--tests/twisted/roster/publish.py32
-rw-r--r--tests/twisted/roster/removed-from-rp-subscribe.py2
-rw-r--r--tests/twisted/roster/subscribe.py9
4 files changed, 33 insertions, 21 deletions
diff --git a/tests/twisted/roster/groups.py b/tests/twisted/roster/groups.py
index 9d7dff6..9b3bd02 100644
--- a/tests/twisted/roster/groups.py
+++ b/tests/twisted/roster/groups.py
@@ -17,6 +17,7 @@ def test(q, bus, conn, stream):
conn.Connect()
q.expect('dbus-signal', signal='StatusChanged',
args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
+ self_handle = conn.GetSelfHandle()
# Close all Group channels to get a clean slate, so we can rely on
# the NewChannels signal for the default group later
@@ -135,7 +136,7 @@ def test(q, bus, conn, stream):
query_ns=ns.ROSTER),
EventPattern('dbus-signal', signal='MembersChanged',
path=scots.object_path,
- args=['', [duncan], [], [], [], 0, cs.GC_REASON_NONE]),
+ args=['', [duncan], [], [], [], self_handle, cs.GC_REASON_NONE]),
EventPattern('dbus-return', method='AddMembers'),
)
assertEquals('duncan@scotland.lit', iq.stanza.query.item['jid'])
@@ -152,7 +153,7 @@ def test(q, bus, conn, stream):
query_ns=ns.ROSTER),
EventPattern('dbus-signal', signal='MembersChanged',
path=default_group.object_path,
- args=['', [], [duncan], [], [], 0, cs.GC_REASON_NONE]),
+ args=['', [], [duncan], [], [], self_handle, cs.GC_REASON_NONE]),
EventPattern('dbus-return', method='RemoveMembers'),
)
assertEquals('duncan@scotland.lit', iq.stanza.query.item['jid'])
@@ -172,10 +173,10 @@ def test(q, bus, conn, stream):
query_ns=ns.ROSTER),
EventPattern('dbus-signal', signal='MembersChanged',
path=still_alive.object_path,
- args=['', [], [romeo], [], [], 0, cs.GC_REASON_NONE]),
+ args=['', [], [romeo], [], [], self_handle, cs.GC_REASON_NONE]),
EventPattern('dbus-signal', signal='MembersChanged',
path=default_group.object_path,
- args=['', [romeo], [], [], [], 0, cs.GC_REASON_NONE]),
+ args=['', [romeo], [], [], [], self_handle, cs.GC_REASON_NONE]),
EventPattern('dbus-return', method='RemoveMembers'),
)
@@ -200,7 +201,7 @@ def test(q, bus, conn, stream):
query_ns=ns.ROSTER),
EventPattern('dbus-signal', signal='MembersChanged',
path=still_alive.object_path,
- args=['', [], [juliet], [], [], 0, cs.GC_REASON_NONE]),
+ args=['', [], [juliet], [], [], self_handle, cs.GC_REASON_NONE]),
EventPattern('dbus-return', method='RemoveMembers'),
)
assertEquals('juliet@capulet.lit', iq.stanza.query.item['jid'])
diff --git a/tests/twisted/roster/publish.py b/tests/twisted/roster/publish.py
index 45bdcd3..02eec95 100644
--- a/tests/twisted/roster/publish.py
+++ b/tests/twisted/roster/publish.py
@@ -65,9 +65,20 @@ def test(q, bus, conn, stream):
stream.send(presence)
# it seems either libpurple or haze doesn't pass the message through
- q.expect('dbus-signal', path=publish.object_path,
- args=['', [], [], [alice], [], alice,
- cs.GC_REASON_NONE])
+ q.expect_many(
+ EventPattern('dbus-signal', path=publish.object_path,
+ args=['', [], [], [alice], [], alice,
+ cs.GC_REASON_NONE]),
+ # In the Conn.I.ContactList world, 'stored' has been
+ # re-purposed to mean "we have some reason to care", so she
+ # appears here even though she's not on the server-side roster
+ # just yet
+ EventPattern('dbus-signal', signal='MembersChanged',
+ path=stored.object_path,
+ args=['', [alice], [], [], [], 0, cs.GC_REASON_NONE]),
+ )
+
+ self_handle = conn.GetSelfHandle()
# accept
call_async(q, publish.Group, 'AddMembers', [alice], '')
@@ -77,7 +88,7 @@ def test(q, bus, conn, stream):
to='alice@wonderland.lit'),
EventPattern('dbus-signal', signal='MembersChanged',
path=publish.object_path,
- args=['', [alice], [], [], [], conn.GetSelfHandle(),
+ args=['', [alice], [], [], [], self_handle,
cs.GC_REASON_NONE]),
EventPattern('dbus-return', method='AddMembers'),
)
@@ -92,18 +103,16 @@ 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'),
- # 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
+ # FIXME: TpBaseContactList assumes she's the actor - she must have
+ # accepted our request, right? Not actually true in libpurple.
EventPattern('dbus-signal', signal='MembersChanged',
path=subscribe.object_path,
- args=['', [alice], [], [], [], 0, cs.GC_REASON_NONE]),
+ args=['', [alice], [], [], [], alice, cs.GC_REASON_NONE]),
# the buddy needs a group, because libpurple
EventPattern('dbus-signal', signal='NewChannels',
predicate=lambda e:
@@ -141,8 +150,7 @@ def test(q, bus, conn, stream):
to='queen.of.hearts@wonderland.lit'),
EventPattern('dbus-signal', signal='MembersChanged',
path=publish.object_path,
- args=['', [], [queen], [], [], conn.GetSelfHandle(),
- cs.GC_REASON_NONE]),
+ args=['', [], [queen], [], [], 0, cs.GC_REASON_NONE]),
EventPattern('dbus-return', method='RemoveMembers'),
)
diff --git a/tests/twisted/roster/removed-from-rp-subscribe.py b/tests/twisted/roster/removed-from-rp-subscribe.py
index db1133b..522255e 100644
--- a/tests/twisted/roster/removed-from-rp-subscribe.py
+++ b/tests/twisted/roster/removed-from-rp-subscribe.py
@@ -70,7 +70,7 @@ def test(q, bus, conn, stream, remove, local):
# in this case) also means subscribe
q.expect_many(
EventPattern('dbus-signal', signal='MembersChanged',
- args=['', [h], [], [], [], 0, 0], path=subscribe.object_path),
+ args=['', [h], [], [], [], h, 0], path=subscribe.object_path),
EventPattern('dbus-signal', signal='MembersChanged',
args=['', [h], [], [], [], 0, 0], path=stored.object_path),
)
diff --git a/tests/twisted/roster/subscribe.py b/tests/twisted/roster/subscribe.py
index 66c5a8c..ba20cdd 100644
--- a/tests/twisted/roster/subscribe.py
+++ b/tests/twisted/roster/subscribe.py
@@ -16,6 +16,7 @@ def test(q, bus, conn, stream):
conn.Connect()
q.expect('dbus-signal', signal='StatusChanged',
args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
+ self_handle = conn.GetSelfHandle()
# Close all Group channels to get a clean slate, so we can rely on
# the NewChannels signal for the default group later
@@ -48,9 +49,11 @@ def test(q, bus, conn, stream):
EventPattern('stream-presence', presence_type='subscribe',
to='suggs@night.boat.cairo'),
EventPattern('dbus-return', method='AddMembers', value=()),
+ # FIXME: TpBaseContactList wrongly assumes that he's the actor,
+ # because he must have accepted our request... right? Wrong.
EventPattern('dbus-signal', signal='MembersChanged',
path=subscribe.object_path,
- args=['', [handle], [], [], [], 0, 0]),
+ args=['', [handle], [], [], [], handle, 0]),
EventPattern('dbus-signal', signal='NewChannels',
predicate=lambda e:
e.args[0][0][1].get(cs.TARGET_HANDLE_TYPE) == cs.HT_GROUP),
@@ -89,10 +92,10 @@ def test(q, bus, conn, stream):
EventPattern('dbus-return', method='AddMembers', value=()),
EventPattern('dbus-signal', signal='MembersChanged',
path=subscribe.object_path,
- args=['', [handle], [], [], [], 0, 0]),
+ args=['', [handle], [], [], [], handle, 0]),
EventPattern('dbus-signal', signal='MembersChanged',
path=def_group.object_path,
- args=['', [handle], [], [], [], 0, 0]),
+ args=['', [handle], [], [], [], self_handle, 0]),
)
acknowledge_iq(stream, set_iq.stanza)