summaryrefslogtreecommitdiff
path: root/tests/twisted/roster
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-02-13 13:25:25 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-02-23 10:51:54 +0100
commit1fc97cba57211fa8075c08ed63d882950b0d9451 (patch)
tree2a286d600c47a28ce38f0f1095cf79cb1810f1b0 /tests/twisted/roster
parentf6eda33b8127fd18a81495c221fed4ac57eba37e (diff)
groups.py: test RenameGroup()
This has been started as a regression test for fdo#45982 which turned to be a tp-glib bug. So we shouldn't merge this commit to master until we depend on a fixed tp-glib.
Diffstat (limited to 'tests/twisted/roster')
-rw-r--r--tests/twisted/roster/groups.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/twisted/roster/groups.py b/tests/twisted/roster/groups.py
index e40410cd4..d9fd67df2 100644
--- a/tests/twisted/roster/groups.py
+++ b/tests/twisted/roster/groups.py
@@ -175,5 +175,36 @@ def test(q, bus, conn, stream):
conn.Contacts.GetContactAttributes([amy],
[cs.CONN_IFACE_CONTACT_GROUPS], False)[amy])
+ # Rename group 'ladies' to 'girls'
+ call_async(q, conn.ContactGroups, 'RenameGroup', 'ladies', 'girls')
+
+ # Amy is added to 'girls'
+ e = q.expect('stream-iq', iq_type='set', query_name='query', query_ns=ns.ROSTER)
+ jid, groups = parse_roster_change_request(e.query, e.stanza)
+ assertEquals('amy@foo.com', jid)
+ assertEquals(set(['girls', 'ladies']), groups)
+
+ send_roster_push(stream, 'amy@foo.com', ['girls', 'ladies'])
+ acknowledge_iq(stream, e.stanza)
+
+ # Amy is removed from 'ladies'
+ e = q.expect('stream-iq', iq_type='set', query_name='query', query_ns=ns.ROSTER)
+ jid, groups = parse_roster_change_request(e.query, e.stanza)
+ assertEquals('amy@foo.com', jid)
+ assertEquals(set(['girls']), groups)
+
+ send_roster_push(stream, 'amy@foo.com', ['girls'])
+ acknowledge_iq(stream, e.stanza)
+
+ q.expect('dbus-return', method='RenameGroup')
+
+ # check everything has been updated
+ groups = conn.Properties.Get(cs.CONN_IFACE_CONTACT_GROUPS, 'Groups')
+ assertContains('girls', groups)
+ assertDoesNotContain('ladies', groups)
+
+ contacts = conn.ContactList.GetContactListAttributes([cs.CONN_IFACE_CONTACT_GROUPS], False)
+ assertEquals(['girls'], contacts[amy][cs.CONN_IFACE_CONTACT_GROUPS + '/groups'])
+
if __name__ == '__main__':
exec_test(test)