本文整理汇总了Python中openlp.core.lib.pluginmanager.PluginManager.get_plugin_by_name方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.get_plugin_by_name方法的具体用法?Python PluginManager.get_plugin_by_name怎么用?Python PluginManager.get_plugin_by_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openlp.core.lib.pluginmanager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.get_plugin_by_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_plugin_by_name_exists_test
# 需要导入模块: from openlp.core.lib.pluginmanager import PluginManager [as 别名]
# 或者: from openlp.core.lib.pluginmanager.PluginManager import get_plugin_by_name [as 别名]
def get_plugin_by_name_exists_test(self):
"""
Test running the get_plugin_by_name() method to find a plugin that exists
"""
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
mocked_plugin = MagicMock()
mocked_plugin.name = 'Mocked Plugin'
plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run finalise_plugins()
result = plugin_manager.get_plugin_by_name('Mocked Plugin')
# THEN: The is_active() and finalise() methods should have been called
self.assertEqual(result, mocked_plugin, 'The result for get_plugin_by_name should be the mocked plugin')