This commit is contained in:
Tim Bentley 2013-03-19 17:53:32 +00:00
parent 5e6ec9d269
commit 861e64ee83
11 changed files with 69 additions and 64 deletions

View File

@ -90,10 +90,10 @@ class Plugin(QtCore.QObject):
**Hook Functions** **Hook Functions**
``checkPreConditions()`` ``check_pre_conditions()``
Provides the Plugin with a handle to check if it can be loaded. Provides the Plugin with a handle to check if it can be loaded.
``createMediaManagerItem()`` ``create_media_manager_item()``
Creates a new instance of MediaManagerItem to be used in the Media Creates a new instance of MediaManagerItem to be used in the Media
Manager. Manager.
@ -174,7 +174,7 @@ class Plugin(QtCore.QObject):
Registry().register_function(u'%s_add_service_item' % self.name, self.processAddServiceEvent) Registry().register_function(u'%s_add_service_item' % self.name, self.processAddServiceEvent)
Registry().register_function(u'%s_config_updated' % self.name, self.config_update) Registry().register_function(u'%s_config_updated' % self.name, self.config_update)
def checkPreConditions(self): def check_pre_conditions(self):
""" """
Provides the Plugin with a handle to check if it can be loaded. Provides the Plugin with a handle to check if it can be loaded.
Failing Preconditions does not stop a settings Tab being created Failing Preconditions does not stop a settings Tab being created
@ -183,13 +183,13 @@ class Plugin(QtCore.QObject):
""" """
return True return True
def setStatus(self): def set_status(self):
""" """
Sets the status of the plugin Sets the status of the plugin
""" """
self.status = Settings().value(self.settingsSection + u'/status') self.status = Settings().value(self.settingsSection + u'/status')
def toggleStatus(self, new_status): def toggle_status(self, new_status):
""" """
Changes the status of the plugin and remembers it Changes the status of the plugin and remembers it
""" """
@ -200,7 +200,7 @@ class Plugin(QtCore.QObject):
elif new_status == PluginStatus.Inactive: elif new_status == PluginStatus.Inactive:
self.finalise() self.finalise()
def isActive(self): def is_active(self):
""" """
Indicates if the plugin is active Indicates if the plugin is active
@ -208,7 +208,7 @@ class Plugin(QtCore.QObject):
""" """
return self.status == PluginStatus.Active return self.status == PluginStatus.Active
def createMediaManagerItem(self): def create_media_manager_item(self):
""" """
Construct a MediaManagerItem object with all the buttons and things Construct a MediaManagerItem object with all the buttons and things
you need, and return it for integration into OpenLP. you need, and return it for integration into OpenLP.

View File

@ -131,7 +131,7 @@ class PluginManager(object):
for plugin in plugins_list: for plugin in plugins_list:
if plugin.checkPreConditions(): if plugin.checkPreConditions():
log.debug(u'Plugin %s active', unicode(plugin.name)) log.debug(u'Plugin %s active', unicode(plugin.name))
plugin.setStatus() plugin.set_status()
else: else:
plugin.status = PluginStatus.Disabled plugin.status = PluginStatus.Disabled
self.plugins.append(plugin) self.plugins.append(plugin)
@ -142,7 +142,7 @@ class PluginManager(object):
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.createMediaManagerItem() plugin.create_media_manager_item()
def hook_settings_tabs(self): def hook_settings_tabs(self):
""" """
@ -190,8 +190,8 @@ class PluginManager(object):
""" """
log.info(u'Initialise Plugins - Started') log.info(u'Initialise Plugins - Started')
for plugin in self.plugins: for plugin in self.plugins:
log.info(u'initialising plugins %s in a %s state' % (plugin.name, plugin.isActive())) log.info(u'initialising plugins %s in a %s state' % (plugin.name, plugin.is_active()))
if plugin.isActive(): if plugin.is_active():
plugin.initialise() plugin.initialise()
log.info(u'Initialisation Complete for %s ' % plugin.name) log.info(u'Initialisation Complete for %s ' % plugin.name)
log.info(u'Initialise Plugins - Finished') log.info(u'Initialise Plugins - Finished')
@ -203,7 +203,7 @@ class PluginManager(object):
""" """
log.info(u'finalising plugins') log.info(u'finalising plugins')
for plugin in self.plugins: for plugin in self.plugins:
if plugin.isActive(): if plugin.is_active():
plugin.finalise() plugin.finalise()
log.info(u'Finalisation Complete for %s ' % plugin.name) log.info(u'Finalisation Complete for %s ' % plugin.name)
@ -222,7 +222,7 @@ class PluginManager(object):
""" """
log.info(u'plugins - new service created') log.info(u'plugins - new service created')
for plugin in self.plugins: for plugin in self.plugins:
if plugin.isActive(): if plugin.is_active():
plugin.new_service_created() plugin.new_service_created()
def _get_settings_form(self): def _get_settings_form(self):

View File

@ -607,7 +607,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
self.application.process_events() self.application.process_events()
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
if plugin.isActive(): if plugin.is_active():
plugin.app_startup() plugin.app_startup()
self.application.process_events() self.application.process_events()
@ -654,10 +654,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.activePlugin.setStatus() self.activePlugin.setStatus()
if oldStatus != self.activePlugin.status: if oldStatus != self.activePlugin.status:
if self.activePlugin.status == PluginStatus.Active: if self.activePlugin.status == PluginStatus.Active:
self.activePlugin.toggleStatus(PluginStatus.Active) self.activePlugin.toggle_status(PluginStatus.Active)
self.activePlugin.app_startup() self.activePlugin.app_startup()
else: else:
self.activePlugin.toggleStatus(PluginStatus.Inactive) self.activePlugin.toggle_status(PluginStatus.Inactive)
# Set global theme and # Set global theme and
Registry().execute(u'theme_update_global', self.theme_manager_contents.global_theme) Registry().execute(u'theme_update_global', self.theme_manager_contents.global_theme)
self.theme_manager_contents.load_first_time_themes() self.theme_manager_contents.load_first_time_themes()

View File

@ -127,7 +127,7 @@ class MediaController(object):
""" """
saved_players = get_media_players()[0] saved_players = get_media_players()[0]
for player in self.media_players.keys(): for player in self.media_players.keys():
self.media_players[player].isActive = player in saved_players self.media_players[player].is_active = player in saved_players
def _generate_extensions_lists(self): def _generate_extensions_lists(self):
""" """
@ -135,14 +135,14 @@ class MediaController(object):
""" """
self.audio_extensions_list = [] self.audio_extensions_list = []
for player in self.media_players.values(): for player in self.media_players.values():
if player.isActive: if player.is_active:
for item in player.audio_extensions_list: for item in player.audio_extensions_list:
if not item in self.audio_extensions_list: if not item in self.audio_extensions_list:
self.audio_extensions_list.append(item) self.audio_extensions_list.append(item)
self.service_manager.supported_suffixes(item[2:]) self.service_manager.supported_suffixes(item[2:])
self.video_extensions_list = [] self.video_extensions_list = []
for player in self.media_players.values(): for player in self.media_players.values():
if player.isActive: if player.is_active:
for item in player.video_extensions_list: for item in player.video_extensions_list:
if item not in self.video_extensions_list: if item not in self.video_extensions_list:
self.video_extensions_list.extend(item) self.video_extensions_list.extend(item)
@ -224,7 +224,7 @@ class MediaController(object):
""" """
css = u'' css = u''
for player in self.media_players.values(): for player in self.media_players.values():
if player.isActive: if player.is_active:
css += player.get_media_display_css() css += player.get_media_display_css()
return css return css
@ -234,7 +234,7 @@ class MediaController(object):
""" """
js = u'' js = u''
for player in self.media_players.values(): for player in self.media_players.values():
if player.isActive: if player.is_active:
js += player.get_media_display_javascript() js += player.get_media_display_javascript()
return js return js
@ -244,7 +244,7 @@ class MediaController(object):
""" """
html = u'' html = u''
for player in self.media_players.values(): for player in self.media_players.values():
if player.isActive: if player.is_active:
html += player.get_media_display_html() html += player.get_media_display_html()
return html return html
@ -325,7 +325,7 @@ class MediaController(object):
if preview: if preview:
display.has_audio = False display.has_audio = False
for player in self.media_players.values(): for player in self.media_players.values():
if player.isActive: if player.is_active:
player.setup(display) player.setup(display)
def set_controls_visible(self, controller, value): def set_controls_visible(self, controller, value):

View File

@ -46,7 +46,7 @@ class MediaPlayer(object):
self.parent = parent self.parent = parent
self.name = name self.name = name
self.available = self.check_available() self.available = self.check_available()
self.isActive = False self.is_active = False
self.can_background = False self.can_background = False
self.can_folder = False self.can_folder = False
self.state = MediaState.Off self.state = MediaState.Off

View File

@ -139,11 +139,11 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
return return
if status == PluginStatus.Inactive: if status == PluginStatus.Inactive:
self.application.set_busy_cursor() self.application.set_busy_cursor()
self.activePlugin.toggleStatus(PluginStatus.Active) self.activePlugin.toggle_status(PluginStatus.Active)
self.application.set_normal_cursor() self.application.set_normal_cursor()
self.activePlugin.app_startup() self.activePlugin.app_startup()
else: else:
self.activePlugin.toggleStatus(PluginStatus.Inactive) self.activePlugin.toggle_status(PluginStatus.Inactive)
status_text = translate('OpenLP.PluginForm', '%s (Inactive)') status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
if self.activePlugin.status == PluginStatus.Active: if self.activePlugin.status == PluginStatus.Active:
status_text = translate('OpenLP.PluginForm', '%s (Active)') status_text = translate('OpenLP.PluginForm', '%s (Active)')

View File

@ -137,7 +137,7 @@ class MediaPlugin(Plugin):
if players: if players:
new_players = [player for player in players if player != u'phonon'] new_players = [player for player in players if player != u'phonon']
new_players.insert(0, u'phonon') new_players.insert(0, u'phonon')
self.media_controller.mediaPlayers[u'phonon'].isActive = True self.media_controller.mediaPlayers[u'phonon'].is_active = True
settings.setValue(u'players', u','.join(new_players)) settings.setValue(u'players', u','.join(new_players))
self.settingsTab.load() self.settingsTab.load()
settings.remove(u'use phonon') settings.remove(u'use phonon')

View File

@ -105,7 +105,7 @@ class PresentationPlugin(Plugin):
controller.kill() controller.kill()
Plugin.finalise(self) Plugin.finalise(self)
def createMediaManagerItem(self): def create_media_manager_item(self):
""" """
Create the Media Manager List Create the Media Manager List
""" """
@ -114,17 +114,16 @@ class PresentationPlugin(Plugin):
def registerControllers(self, controller): def registerControllers(self, controller):
""" """
Register each presentation controller (Impress, PPT etc) and Register each presentation controller (Impress, PPT etc) and store for later use
store for later use
""" """
self.controllers[controller.name] = controller self.controllers[controller.name] = controller
def checkPreConditions(self): def check_pre_conditions(self):
""" """
Check to see if we have any presentation software available Check to see if we have any presentation software available
If Not do not install the plugin. If Not do not install the plugin.
""" """
log.debug(u'checkPreConditions') log.debug(u'check_pre_conditions')
controller_dir = os.path.join( controller_dir = os.path.join(
AppLocation.get_directory(AppLocation.PluginsDir), AppLocation.get_directory(AppLocation.PluginsDir),
u'presentations', u'lib') u'presentations', u'lib')

View File

@ -85,7 +85,10 @@ class SongsPlugin(Plugin):
self.iconPath = u':/plugins/plugin_songs.png' self.iconPath = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.iconPath)
def checkPreConditions(self): def check_pre_conditions(self):
"""
Check the plugin can run.
"""
return self.manager.session is not None return self.manager.session is not None
def initialise(self): def initialise(self):

View File

@ -68,7 +68,10 @@ class SongUsagePlugin(Plugin):
self.inactiveIcon = build_icon(u':/songusage/song_usage_inactive.png') self.inactiveIcon = build_icon(u':/songusage/song_usage_inactive.png')
self.song_usage_active = False self.song_usage_active = False
def checkPreConditions(self): def check_pre_conditions(self):
"""
Check the plugin can run.
"""
return self.manager.session is not None return self.manager.session is not None
def addToolsMenuItem(self, tools_menu): def addToolsMenuItem(self, tools_menu):

View File

@ -41,9 +41,9 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_media_manager() # WHEN: We run hook_media_manager()
plugin_manager.hook_media_manager() plugin_manager.hook_media_manager()
# THEN: The createMediaManagerItem() method should have been called # THEN: The create_media_manager_item() method should have been called
assert mocked_plugin.createMediaManagerItem.call_count == 0, \ assert mocked_plugin.create_media_manager_item.call_count == 0, \
u'The createMediaManagerItem() method should not have been called.' u'The create_media_manager_item() method should not have been called.'
def hook_media_manager_with_active_plugin_test(self): def hook_media_manager_with_active_plugin_test(self):
""" """
@ -58,8 +58,8 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_media_manager() # WHEN: We run hook_media_manager()
plugin_manager.hook_media_manager() plugin_manager.hook_media_manager()
# THEN: The createMediaManagerItem() method should have been called # THEN: The create_media_manager_item() method should have been called
mocked_plugin.createMediaManagerItem.assert_called_with() mocked_plugin.create_media_manager_item.assert_called_with()
def hook_settings_tabs_with_disabled_plugin_and_no_form_test(self): def hook_settings_tabs_with_disabled_plugin_and_no_form_test(self):
""" """
@ -75,8 +75,8 @@ class TestPluginManager(TestCase):
plugin_manager.hook_settings_tabs() plugin_manager.hook_settings_tabs()
# THEN: The createSettingsTab() method should have been called # THEN: The createSettingsTab() method should have been called
assert mocked_plugin.createMediaManagerItem.call_count == 0, \ assert mocked_plugin.create_media_manager_item.call_count == 0, \
u'The createMediaManagerItem() method should not have been called.' u'The create_media_manager_item() method should not have been called.'
def hook_settings_tabs_with_disabled_plugin_and_mocked_form_test(self): def hook_settings_tabs_with_disabled_plugin_and_mocked_form_test(self):
""" """
@ -96,7 +96,7 @@ class TestPluginManager(TestCase):
# THEN: The createSettingsTab() method should not have been called, but the plugins lists should be the same # THEN: The createSettingsTab() method should not have been called, but the plugins lists should be the same
assert mocked_plugin.createSettingsTab.call_count == 0, \ assert mocked_plugin.createSettingsTab.call_count == 0, \
u'The createMediaManagerItem() method should not have been called.' u'The create_media_manager_item() method should not have been called.'
self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins, self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins,
u'The plugins on the settings form should be the same as the plugins in the plugin manager') u'The plugins on the settings form should be the same as the plugins in the plugin manager')
@ -116,9 +116,9 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_settings_tabs() # WHEN: We run hook_settings_tabs()
plugin_manager.hook_settings_tabs() plugin_manager.hook_settings_tabs()
# THEN: The createMediaManagerItem() method should have been called with the mocked settings form # THEN: The create_media_manager_item() method should have been called with the mocked settings form
assert mocked_plugin.createSettingsTab.call_count == 1, \ assert mocked_plugin.createSettingsTab.call_count == 1, \
u'The createMediaManagerItem() method should have been called once.' u'The create_media_manager_item() method should have been called once.'
self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins, self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins,
u'The plugins on the settings form should be the same as the plugins in the plugin manager') u'The plugins on the settings form should be the same as the plugins in the plugin manager')
@ -151,7 +151,7 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_import_menu() # WHEN: We run hook_import_menu()
plugin_manager.hook_import_menu() plugin_manager.hook_import_menu()
# THEN: The createMediaManagerItem() method should have been called # THEN: The create_media_manager_item() method should have been called
assert mocked_plugin.addImportMenuItem.call_count == 0, \ assert mocked_plugin.addImportMenuItem.call_count == 0, \
u'The addImportMenuItem() method should not have been called.' u'The addImportMenuItem() method should not have been called.'
@ -244,15 +244,15 @@ class TestPluginManager(TestCase):
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
mocked_plugin = MagicMock() mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled mocked_plugin.status = PluginStatus.Disabled
mocked_plugin.isActive.return_value = False mocked_plugin.is_active.return_value = False
plugin_manager = PluginManager() plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin] plugin_manager.plugins = [mocked_plugin]
# WHEN: We run initialise_plugins() # WHEN: We run initialise_plugins()
plugin_manager.initialise_plugins() plugin_manager.initialise_plugins()
# THEN: The isActive() method should have been called, and initialise() method should NOT have been called # THEN: The is_active() method should have been called, and initialise() method should NOT have been called
mocked_plugin.isActive.assert_called_with() mocked_plugin.is_active.assert_called_with()
assert mocked_plugin.initialise.call_count == 0, u'The initialise() method should not have been called.' assert mocked_plugin.initialise.call_count == 0, u'The initialise() method should not have been called.'
def initialise_plugins_with_active_plugin_test(self): def initialise_plugins_with_active_plugin_test(self):
@ -262,15 +262,15 @@ class TestPluginManager(TestCase):
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
mocked_plugin = MagicMock() mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active mocked_plugin.status = PluginStatus.Active
mocked_plugin.isActive.return_value = True mocked_plugin.is_active.return_value = True
plugin_manager = PluginManager() plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin] plugin_manager.plugins = [mocked_plugin]
# WHEN: We run initialise_plugins() # WHEN: We run initialise_plugins()
plugin_manager.initialise_plugins() plugin_manager.initialise_plugins()
# THEN: The isActive() and initialise() methods should have been called # THEN: The is_active() and initialise() methods should have been called
mocked_plugin.isActive.assert_called_with() mocked_plugin.is_active.assert_called_with()
mocked_plugin.initialise.assert_called_with() mocked_plugin.initialise.assert_called_with()
def finalise_plugins_with_disabled_plugin_test(self): def finalise_plugins_with_disabled_plugin_test(self):
@ -280,15 +280,15 @@ class TestPluginManager(TestCase):
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
mocked_plugin = MagicMock() mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled mocked_plugin.status = PluginStatus.Disabled
mocked_plugin.isActive.return_value = False mocked_plugin.is_active.return_value = False
plugin_manager = PluginManager() plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin] plugin_manager.plugins = [mocked_plugin]
# WHEN: We run finalise_plugins() # WHEN: We run finalise_plugins()
plugin_manager.finalise_plugins() plugin_manager.finalise_plugins()
# THEN: The isActive() method should have been called, and initialise() method should NOT have been called # THEN: The is_active() method should have been called, and initialise() method should NOT have been called
mocked_plugin.isActive.assert_called_with() mocked_plugin.is_active.assert_called_with()
assert mocked_plugin.finalise.call_count == 0, u'The finalise() method should not have been called.' assert mocked_plugin.finalise.call_count == 0, u'The finalise() method should not have been called.'
def finalise_plugins_with_active_plugin_test(self): def finalise_plugins_with_active_plugin_test(self):
@ -298,15 +298,15 @@ class TestPluginManager(TestCase):
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
mocked_plugin = MagicMock() mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active mocked_plugin.status = PluginStatus.Active
mocked_plugin.isActive.return_value = True mocked_plugin.is_active.return_value = True
plugin_manager = PluginManager() plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin] plugin_manager.plugins = [mocked_plugin]
# WHEN: We run finalise_plugins() # WHEN: We run finalise_plugins()
plugin_manager.finalise_plugins() plugin_manager.finalise_plugins()
# THEN: The isActive() and finalise() methods should have been called # THEN: The is_active() and finalise() methods should have been called
mocked_plugin.isActive.assert_called_with() mocked_plugin.is_active.assert_called_with()
mocked_plugin.finalise.assert_called_with() mocked_plugin.finalise.assert_called_with()
def get_plugin_by_name_does_not_exist_test(self): def get_plugin_by_name_does_not_exist_test(self):
@ -322,7 +322,7 @@ class TestPluginManager(TestCase):
# WHEN: We run finalise_plugins() # WHEN: We run finalise_plugins()
result = plugin_manager.get_plugin_by_name('Missing Plugin') result = plugin_manager.get_plugin_by_name('Missing Plugin')
# THEN: The isActive() and finalise() methods should have been called # THEN: The is_active() and finalise() methods should have been called
self.assertIsNone(result, u'The result for get_plugin_by_name should be None') self.assertIsNone(result, u'The result for get_plugin_by_name should be None')
def get_plugin_by_name_exists_test(self): def get_plugin_by_name_exists_test(self):
@ -338,7 +338,7 @@ class TestPluginManager(TestCase):
# WHEN: We run finalise_plugins() # WHEN: We run finalise_plugins()
result = plugin_manager.get_plugin_by_name('Mocked Plugin') result = plugin_manager.get_plugin_by_name('Mocked Plugin')
# THEN: The isActive() and finalise() methods should have been called # THEN: The is_active() and finalise() methods should have been called
self.assertEqual(result, mocked_plugin, u'The result for get_plugin_by_name should be the mocked plugin') self.assertEqual(result, mocked_plugin, u'The result for get_plugin_by_name should be the mocked plugin')
def new_service_created_with_disabled_plugin_test(self): def new_service_created_with_disabled_plugin_test(self):
@ -348,7 +348,7 @@ class TestPluginManager(TestCase):
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
mocked_plugin = MagicMock() mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled mocked_plugin.status = PluginStatus.Disabled
mocked_plugin.isActive.return_value = False mocked_plugin.is_active.return_value = False
plugin_manager = PluginManager() plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin] plugin_manager.plugins = [mocked_plugin]
@ -356,7 +356,7 @@ class TestPluginManager(TestCase):
plugin_manager.new_service_created() plugin_manager.new_service_created()
# THEN: The isActive() method should have been called, and initialise() method should NOT have been called # THEN: The isActive() method should have been called, and initialise() method should NOT have been called
mocked_plugin.isActive.assert_called_with() mocked_plugin.is_active.assert_called_with()
assert mocked_plugin.new_service_created.call_count == 0,\ assert mocked_plugin.new_service_created.call_count == 0,\
u'The new_service_created() method should not have been called.' u'The new_service_created() method should not have been called.'
@ -367,13 +367,13 @@ class TestPluginManager(TestCase):
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active # GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
mocked_plugin = MagicMock() mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active mocked_plugin.status = PluginStatus.Active
mocked_plugin.isActive.return_value = True mocked_plugin.is_active.return_value = True
plugin_manager = PluginManager() plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin] plugin_manager.plugins = [mocked_plugin]
# WHEN: We run new_service_created() # WHEN: We run new_service_created()
plugin_manager.new_service_created() plugin_manager.new_service_created()
# THEN: The isActive() and finalise() methods should have been called # THEN: The is_active() and finalise() methods should have been called
mocked_plugin.isActive.assert_called_with() mocked_plugin.is_active.assert_called_with()
mocked_plugin.new_service_created.assert_called_with() mocked_plugin.new_service_created.assert_called_with()