Example #1
0
    def test_extension_loaded_for_non_core_plugin(self):
        class NonCorePluginExtenstion(StubExtension):
            def get_plugin_interface(self):
                return None

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

        self.assertTrue("e1" in ext_mgr.extensions)
Example #2
0
    def test_unsupported_extensions_are_not_loaded(self):
        stub_plugin = StubPlugin(supported_extensions=["e1", "e3"])
        ext_mgr = PluginAwareExtensionManager('', stub_plugin)

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

        self.assertTrue("e1" in ext_mgr.extensions)
        self.assertFalse("e2" in ext_mgr.extensions)
        self.assertTrue("e3" in ext_mgr.extensions)
Example #3
0
    def test_extensions_expecting_quantum_plugin_interface_are_loaded(self):
        class ExtensionForQuamtumPluginInterface(StubExtension):
            """
            This Extension does not implement get_plugin_interface method.
            This will work with any plugin implementing QuantumPluginBase
            """
            pass
        stub_plugin = StubPlugin(supported_extensions=["e1"])
        ext_mgr = PluginAwareExtensionManager('', stub_plugin)
        ext_mgr.add_extension(ExtensionForQuamtumPluginInterface("e1"))

        self.assertTrue("e1" in ext_mgr.extensions)
Example #4
0
    def test_extensions_without_need_for__plugin_interface_are_loaded(self):
        class ExtensionWithNoNeedForPluginInterface(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 = StubPlugin(supported_extensions=["e1"])
        ext_mgr = PluginAwareExtensionManager('', stub_plugin)
        ext_mgr.add_extension(ExtensionWithNoNeedForPluginInterface("e1"))

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