telepathy-gabble: groups-12791.py: stop using the old roster API
Guillaume Desmottes
gdesmott at kemper.freedesktop.org
Tue Oct 8 12:53:34 PDT 2013
Module: telepathy-gabble
Branch: master
Commit: ea7899a48385346e75bc44c1f98c61ba76d6564d
URL: http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=ea7899a48385346e75bc44c1f98c61ba76d6564d
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Tue Oct 8 13:25:05 2013 -0400
groups-12791.py: stop using the old roster API
---
tests/twisted/roster/groups-12791.py | 40 ++++++++++++++++++---------------
1 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/tests/twisted/roster/groups-12791.py b/tests/twisted/roster/groups-12791.py
index 9956ec1..0bfaf94 100644
--- a/tests/twisted/roster/groups-12791.py
+++ b/tests/twisted/roster/groups-12791.py
@@ -3,8 +3,8 @@ Test broken groups on the roster (regression test for fd.o #12791)
"""
from gabbletest import exec_test
-from rostertest import expect_contact_list_signals, check_contact_list_signals
-from servicetest import assertLength
+from servicetest import assertLength, assertSameSets, EventPattern
+from rostertest import check_contact_roster, contacts_changed_predicate, groups_created_predicate
import constants as cs
import ns
@@ -47,24 +47,28 @@ def test(q, bus, conn, stream):
stream.send(event.stanza)
- pairs = expect_contact_list_signals(q, bus, conn,
- ['publish', 'subscribe', 'stored'],
- ['men', 'women', 'affected-by-fdo-12791'])
+ contacts = [
+ ('amy at foo.com', cs.SUBSCRIPTION_STATE_YES, cs.SUBSCRIPTION_STATE_YES, ''),
+ ('bob at foo.com', cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_YES, ''),
+ ('che at foo.com', cs.SUBSCRIPTION_STATE_YES, cs.SUBSCRIPTION_STATE_NO, ''),
+ ]
- check_contact_list_signals(q, bus, conn, pairs.pop(0), cs.HT_LIST,
- 'publish', ['amy at foo.com', 'bob at foo.com'])
- check_contact_list_signals(q, bus, conn, pairs.pop(0), cs.HT_LIST,
- 'subscribe', ['amy at foo.com', 'che at foo.com'])
- check_contact_list_signals(q, bus, conn, pairs.pop(0), cs.HT_LIST,
- 'stored', ['amy at foo.com', 'bob at foo.com', 'che at foo.com'])
- check_contact_list_signals(q, bus, conn, pairs.pop(0), cs.HT_GROUP,
- 'men', ['bob at foo.com', 'che at foo.com'])
- check_contact_list_signals(q, bus, conn, pairs.pop(0), cs.HT_GROUP,
- 'women', ['amy at foo.com'])
- check_contact_list_signals(q, bus, conn, pairs.pop(0), cs.HT_GROUP,
- 'affected-by-fdo-12791', [])
+ q.expect_many(
+ EventPattern('dbus-signal', signal='ContactsChangedWithID',
+ predicate=lambda e: contacts_changed_predicate(e, conn, contacts)),
+ EventPattern('dbus-signal', signal='GroupsCreated',
+ predicate=lambda e: groups_created_predicate(e, ['women', 'men', 'affected-by-fdo-12791'])),
+ )
- assertLength(0, pairs) # i.e. we've checked all of them
+ contacts = conn.ContactList.GetContactListAttributes([cs.CONN_IFACE_CONTACT_GROUPS], False)
+ assertLength(3, contacts)
+
+ check_contact_roster(conn, 'amy at foo.com', ['women'])
+ check_contact_roster(conn, 'bob at foo.com', ['men'])
+ check_contact_roster(conn, 'che at foo.com', ['men'])
+
+ groups = conn.Properties.Get(cs.CONN_IFACE_CONTACT_GROUPS, 'Groups')
+ assertSameSets(['men', 'women', 'affected-by-fdo-12791'], groups)
if __name__ == '__main__':
exec_test(test)
More information about the telepathy-commits
mailing list