Unittest to reproduce #4208. With some tweaks to data.py it should also help to reproduce #4195.

This commit is contained in:
Stephan Erb 2008-08-18 22:15:45 +00:00
parent 2712786383
commit 0bc1ac47f7
2 changed files with 48 additions and 5 deletions

View File

@ -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:

View File

@ -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()