Exemple #1
0
    def test_extension_loaded_for_non_core_plugin(self):
        class NonCorePluginExtenstion(ext_stubs.StubExtension):
            def get_plugin_interface(self):
                return None

        stub_plugin = ext_stubs.StubPlugin(supported_extensions=["e1"])
        plugin_info = {constants.DUMMY: stub_plugin}
        ext_mgr = extensions.PluginAwareExtensionManager('', plugin_info)
        ext_mgr.add_extension(NonCorePluginExtenstion("e1"))

        self.assertTrue("e1" in ext_mgr.extensions)
Exemple #2
0
    def test_unsupported_extensions_are_not_loaded(self):
        stub_plugin = ext_stubs.StubPlugin(supported_extensions=["e1", "e3"])
        plugin_info = {constants.CORE: stub_plugin}
        ext_mgr = extensions.PluginAwareExtensionManager('', plugin_info)

        ext_mgr.add_extension(ext_stubs.StubExtension("e1"))
        ext_mgr.add_extension(ext_stubs.StubExtension("e2"))
        ext_mgr.add_extension(ext_stubs.StubExtension("e3"))

        self.assertTrue("e1" in ext_mgr.extensions)
        self.assertFalse("e2" in ext_mgr.extensions)
        self.assertTrue("e3" in ext_mgr.extensions)
Exemple #3
0
    def test_extensions_expecting_quantum_plugin_interface_are_loaded(self):
        class ExtensionForQuamtumPluginInterface(ext_stubs.StubExtension):
            """This Extension does not implement get_plugin_interface method.

            This will work with any plugin implementing QuantumPluginBase
            """
            pass

        stub_plugin = ext_stubs.StubPlugin(supported_extensions=["e1"])
        plugin_info = {constants.CORE: stub_plugin}
        ext_mgr = extensions.PluginAwareExtensionManager('', plugin_info)
        ext_mgr.add_extension(ExtensionForQuamtumPluginInterface("e1"))

        self.assertTrue("e1" in ext_mgr.extensions)
Exemple #4
0
    def test_extensions_without_need_for__plugin_interface_are_loaded(self):
        class ExtensionWithNoNeedForPluginInterface(ext_stubs.StubExtension):
            """This Extension does not need any plugin interface.

            This will work with any plugin implementing QuantumPluginBase
            """
            def get_plugin_interface(self):
                return None

        stub_plugin = ext_stubs.StubPlugin(supported_extensions=["e1"])
        plugin_info = {constants.CORE: stub_plugin}
        ext_mgr = extensions.PluginAwareExtensionManager('', plugin_info)
        ext_mgr.add_extension(ExtensionWithNoNeedForPluginInterface("e1"))

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