Vinkesh/Deepak| Added doc and small refactoring

This commit is contained in:
Deepak N 2011-07-19 10:20:48 +05:30
parent 2392ba0066
commit 0781498b84
2 changed files with 9 additions and 1 deletions

View File

@ -369,7 +369,7 @@ class ExtensionManager(object):
expected_methods = self._get_public_methods(interface)
implemented_methods = self._get_public_methods(self.plugin.__class__)
missing_methods = set(expected_methods) - set(implemented_methods)
return len(missing_methods) == 0
return not missing_methods
def _get_public_methods(self, klass):
return filter(lambda name: not(name.startswith("_")),

View File

@ -102,6 +102,10 @@ class StubPlugin(object):
class ExtensionExpectingPluginInterface(StubExtension):
"""
This extension expects plugin to implement all the methods defined
in PluginInterface
"""
def get_plugin_interface(self):
return PluginInterface
@ -122,6 +126,10 @@ class ExtensionManagerTest(unittest.TestCase):
def test_invalid_extensions_are_not_registered(self):
class InvalidExtension(object):
"""
This Extension doesn't implement extension methods :
get_name, get_description, get_namespace and get_updated
"""
def get_alias(self):
return "invalid_extension"