From 0bc1ac47f7067414a5e332efa3022359883da43c Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Mon, 18 Aug 2008 22:15:45 +0000 Subject: [PATCH] Unittest to reproduce #4208. With some tweaks to data.py it should also help to reproduce #4195. --- test/lib/data.py | 38 +++++++++++++++++++++++++++++++++++++- test/test_roster.py | 15 +++++++++++---- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/test/lib/data.py b/test/lib/data.py index d7c19af5f..0e144290b 100755 --- a/test/lib/data.py +++ b/test/lib/data.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- account1 = u'acc1' account2 = u'Cool"chârßéµö' +account3 = u'dingdong.org' contacts = {} contacts[account1] = { @@ -31,5 +32,40 @@ contacts[account2] = { 'ask': None, 'groups': [u'GroupA', u'GroupB'], 'name': None, 'resources': {}, 'subscription': u'both'} } +contacts[account3] = { + #u'guypsych0\\40h.com@msn.dingdong.org': { + # 'ask': None, 'groups': [], 'name': None, 'resources': {}, + # 'subscription': u'both'}, + u'guypsych0%h.com@msn.delx.cjb.net': { + 'ask': u'subscribe', 'groups': [], 'name': None, + 'resources': {}, 'subscription': u'from'}, + #u'guypsych0%h.com@msn.jabber.wiretrip.org': { + # 'ask': None, 'groups': [], 'name': None, 'resources': {}, + # 'subscription': u'to'}, + #u'guypsycho\\40g.com@gtalk.dingdong.org': { + # 'ask': None, 'groups': [], 'name': None, + # 'resources': {}, 'subscription': u'both'} +} + +metacontact_data = [ + [{'account': account3, + 'jid': u'guypsych0\\40h.com@msn.dingdong.org', + 'order': 0}, + {'account': account3, + 'jid': u'guypsych0%h.com@msn.delx.cjb.net', + 'order': 0}, + {'account': account3, + 'jid': u'guypsych0%h.com@msn.jabber.wiretrip.org', + 'order': 0}, + {'account': account3, + 'jid': u'guypsycho\\40g.com@gtalk.dingdong.org', + 'order': 0}], + + [{'account': account1, + 'jid': u'samejid@gajim.org', + 'order': 0}, + {'account': account2, + 'jid': u'samejid@gajim.org', + 'order': 0}] + ] -# vim: se ts=3: diff --git a/test/test_roster.py b/test/test_roster.py index 21a48a637..6cba5703b 100644 --- a/test/test_roster.py +++ b/test/test_roster.py @@ -144,10 +144,16 @@ class TestRosterWindowRegrouped(TestRosterWindow): class TestRosterWindowMetaContacts(TestRosterWindowRegrouped): - def setUp(self): - gajim.contacts.add_metacontact(account1, u'samejid@gajim.org', - account2, u'samejid@gajim.org') - TestRosterWindowRegrouped.setUp(self) + def test_receive_metacontact_data(self): + for complete_data in metacontact_data: + t_acc = complete_data[0]['account'] + t_jid = complete_data[0]['jid'] + data = complete_data[1:] + for brother in data: + acc = brother['account'] + jid = brother['jid'] + gajim.contacts.add_metacontact(t_acc, t_jid, acc, jid) + self.roster.setup_and_draw_roster() def test_connect_new_metacontact(self): self.test_fill_roster_model() @@ -165,6 +171,7 @@ class TestRosterWindowMetaContacts(TestRosterWindowRegrouped): self.assert_model_is_in_sync() + if __name__ == '__main__': unittest.main()