From 0781498b8459e5df2d12e61e07cfac8236fc6349 Mon Sep 17 00:00:00 2001 From: Deepak N Date: Tue, 19 Jul 2011 10:20:48 +0530 Subject: [PATCH] Vinkesh/Deepak| Added doc and small refactoring --- quantum/common/extensions.py | 2 +- tests/unit/test_extensions.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/quantum/common/extensions.py b/quantum/common/extensions.py index 7d4672699..1d9d38bbb 100644 --- a/quantum/common/extensions.py +++ b/quantum/common/extensions.py @@ -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("_")), diff --git a/tests/unit/test_extensions.py b/tests/unit/test_extensions.py index d806469a0..591a49416 100644 --- a/tests/unit/test_extensions.py +++ b/tests/unit/test_extensions.py @@ -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" -- 2.45.2