Exemple #1
0
    def test_extensions_not_loaded_for_plugin_without_expected_interface(self):
        class PluginWithoutExpectedInterface(object):
            """
            Plugin does not implement get_foo method as expected by extension
            """
            supported_extension_aliases = ["supported_extension"]

        ext_mgr = PluginAwareExtensionManager('',
                                              PluginWithoutExpectedInterface())
        ext_mgr.add_extension(
            ExtensionExpectingPluginInterface("supported_extension"))

        self.assertFalse("e1" in ext_mgr.extensions)
Exemple #2
0
    def test_extensions_are_loaded_for_plugin_with_expected_interface(self):
        class PluginWithExpectedInterface(object):
            """
            This Plugin implements get_foo method as expected by extension
            """
            supported_extension_aliases = ["supported_extension"]

            def get_foo(self, bar=None):
                pass

        ext_mgr = PluginAwareExtensionManager('',
                                              PluginWithExpectedInterface())
        ext_mgr.add_extension(
            ExtensionExpectingPluginInterface("supported_extension"))

        self.assertTrue("supported_extension" in ext_mgr.extensions)