diff src/test/helpers.py @ 944:e1842ebcb2f3

core, plugin XEP-0115: discovery refactoring: - hashing algorithm of XEP-0115 has been including in core - our own hash is still calculated by XEP-0115 and can be regenerated with XEP_0115.recalculateHash - old discovery methods have been removed. Now the following methods are used: - hasFeature: tell if a feature is available for an entity - getDiscoInfos: self explaining - getDiscoItems: self explaining - findServiceEntities: return all available items of an entity which given (category, type) - findFeaturesSet: search for a set of features in entity + entity's items all these methods are asynchronous, and manage cache automatically - XEP-0115 manage in a better way hashes, and now use a trigger for presence instead of monkey patch - new FeatureNotFound exception, when we want to do something which is not available - refactored client initialisation sequence, removed client.initialized Deferred - added constant APP_URL - test_plugin_xep_0033.py has been temporarly deactivated, the time to adapt it - lot of cleaning
author Goffi <goffi@goffi.org>
date Fri, 28 Mar 2014 18:07:22 +0100
parents c6d8fc63b1db
children b3f383ab39da
line wrap: on
line diff
--- a/src/test/helpers.py	Fri Mar 28 18:07:17 2014 +0100
+++ b/src/test/helpers.py	Fri Mar 28 18:07:22 2014 +0100
@@ -90,26 +90,6 @@
         self.stored_messages.append(mess_data["to"])
         pass
 
-    def requestServerDisco(self, feature, jid_=None, cache_only=False, profile_key="@NONE"):
-        """Discover if a server or its items offer a given feature
-        @param feature: the feature to check
-        @param jid_: the jid of the server, local server if None
-        @param cache_only: expect the result to be in cache and don't actually
-        make any request. This can be used anytime for requesting a feature on
-        the local server because the data are cached for sure.
-        @result: the Deferred entity jid offering the feature, or None
-        """
-        profile = self.memory.getProfileName(profile_key)
-        self.memory.server_features.setdefault(profile, {})
-        if jid_ is None:
-            jid_ = self.getClientHostJid(profile_key)
-        # call FakeMemory.init and FakeMemory.addServerFeature
-        # in your tests to change the return value of this method
-        return defer.succeed(jid_ if self.memory.hasServerFeature(feature, jid_, profile_key) else None)
-
-    def getClientHostJid(self, profile_key):
-        return Const.PROFILE_DICT[profile_key].host
-
     def getClient(self, profile_key):
         """Convenient method to get client from profile key
         @return: client or None if it doesn't exist"""
@@ -118,7 +98,6 @@
             raise exceptions.ProfileKeyUnknownError
         if profile not in self.profiles:
             self.profiles[profile] = FakeClient(self, profile)
-            self.profiles[profile].client_initialized.callback(None)
         return self.profiles[profile]
 
     def getJidNStream(self, profile_key):
@@ -241,7 +220,6 @@
         self.params.params.clear()
         self.params.frontends_cache = []
         self.entities_data = {}
-        self.server_features = {}
 
     def getProfileName(self, profile_key, return_profile_keys=False):
         return self.params.getProfileName(profile_key, return_profile_keys)
@@ -323,7 +301,6 @@
         self.profile = profile if profile else Const.PROFILE[0]
         self.jid = Const.PROFILE_DICT[self.profile]
         self.roster = FakeRosterProtocol(host, self)
-        self.client_initialized = defer.Deferred()
         self.xmlstream = FakeXmlStream()
 
     def send(self, obj):