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