comparison src/test/helpers.py @ 1910:55440ee00905

test: update some tests
author souliane <souliane@mailoo.org>
date Fri, 11 Mar 2016 17:42:56 +0100
parents 0681d69cbe0a
children 2daf7b4c6756
comparison
equal deleted inserted replaced
1909:0681d69cbe0a 1910:55440ee00905
188 been previously initialized with the method FakeSAT.getClient. 188 been previously initialized with the method FakeSAT.getClient.
189 @return: XML representation of the sent message for given profile, or None""" 189 @return: XML representation of the sent message for given profile, or None"""
190 entry = self.getSentMessage(profile_index) 190 entry = self.getSentMessage(profile_index)
191 return entry.toXml() if entry else None 191 return entry.toXml() if entry else None
192 192
193 def findFeaturesSet(self, features, category=None, type_=None, jid_=None, profile_key=None): 193 def findFeaturesSet(self, features, identity=None, jid_=None, profile=C.PROF_KEY_NONE):
194 """Call self.addFeature from your tests to change the return value. 194 """Call self.addFeature from your tests to change the return value.
195 195
196 @return: a set of entities 196 @return: a set of entities
197 """ 197 """
198 client = self.getClient(profile_key) 198 client = self.getClient(profile)
199 if jid_ is None: 199 if jid_ is None:
200 jid_ = JID(client.jid.host) 200 jid_ = JID(client.jid.host)
201 try: 201 try:
202 if set(features).issubset(client.features[jid_]): 202 if set(features).issubset(client.features[jid_]):
203 return defer.succeed(set([jid_])) 203 return defer.succeed(set([jid_]))
299 def __init__(self, host): 299 def __init__(self, host):
300 # do not call Memory.__init__, we just want to call the methods that are 300 # do not call Memory.__init__, we just want to call the methods that are
301 # manipulating basic stuff, the others should be overwritten when needed 301 # manipulating basic stuff, the others should be overwritten when needed
302 self.host = host 302 self.host = host
303 self.params = FakeParams(host, None) 303 self.params = FakeParams(host, None)
304 self.config = self.parseMainConf() 304 self.config = tools_config.parseMainConf()
305 self.reinit() 305 self.reinit()
306 306
307 def reinit(self): 307 def reinit(self):
308 """Tests that manipulate params, entities, features should 308 """Tests that manipulate params, entities, features should
309 re-initialise the memory first to not fake the result.""" 309 re-initialise the memory first to not fake the result."""