Vinkesh/Deepak| Added doc and small refactoring
This commit is contained in:
parent
2392ba0066
commit
0781498b84
|
@ -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("_")),
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue