comparison src/test/helpers.py @ 1412:979210da778a

test: fix the tests
author souliane <souliane@mailoo.org>
date Fri, 17 Apr 2015 19:06:39 +0200
parents 069ad98b360d
children 7e749e8eefd0
comparison
equal deleted inserted replaced
1411:8767c0bb7d48 1412:979210da778a
337 """This class is used by FakeClient (one instance per profile)""" 337 """This class is used by FakeClient (one instance per profile)"""
338 338
339 def __init__(self, host, parent): 339 def __init__(self, host, parent):
340 SatRosterProtocol.__init__(self, host) 340 SatRosterProtocol.__init__(self, host)
341 self.parent = parent 341 self.parent = parent
342 self._jids = {}
342 self.addItem(parent.jid) 343 self.addItem(parent.jid)
343 344
344 def addItem(self, jid, *args, **kwargs): 345 def addItem(self, jid, *args, **kwargs):
345 if not args and not kwargs: 346 if not args and not kwargs:
346 # defaults values setted for the tests only 347 # defaults values setted for the tests only
349 roster_item = RosterItem(jid, *args, **kwargs) 350 roster_item = RosterItem(jid, *args, **kwargs)
350 attrs = {'to': b2s(roster_item.subscriptionTo), 'from': b2s(roster_item.subscriptionFrom), 'ask': b2s(roster_item.pendingOut)} 351 attrs = {'to': b2s(roster_item.subscriptionTo), 'from': b2s(roster_item.subscriptionFrom), 'ask': b2s(roster_item.pendingOut)}
351 if roster_item.name: 352 if roster_item.name:
352 attrs['name'] = roster_item.name 353 attrs['name'] = roster_item.name
353 self.host.bridge.expectCall("newContact", jid.full(), attrs, roster_item.groups, self.parent.profile) 354 self.host.bridge.expectCall("newContact", jid.full(), attrs, roster_item.groups, self.parent.profile)
354 self.onRosterSet(roster_item) 355 self._jids[jid] = roster_item
356 self._registerItem(roster_item)
355 357
356 358
357 class FakeXmlStream(object): 359 class FakeXmlStream(object):
358 """This class is used by FakeClient (one instance per profile)""" 360 """This class is used by FakeClient (one instance per profile)"""
359 361