failing tests

This commit is contained in:
Tim Bentley 2013-02-27 21:42:21 +00:00
parent c564b05f36
commit 73aafdb62c

View File

@ -78,6 +78,25 @@ class TestPluginManager(TestCase):
assert mocked_plugin.createMediaManagerItem.call_count == 0, \ assert mocked_plugin.createMediaManagerItem.call_count == 0, \
u'The createMediaManagerItem() method should not have been called.' u'The createMediaManagerItem() method should not have been called.'
def hook_settings_tabs_with_disabled_plugin_and_mocked_form_test(self):
"""
Test running the hook_settings_tabs() method with a disabled plugin and a mocked form
"""
# 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
plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_settings_tabs()
plugin_manager.hook_settings_tabs()
# THEN: The createSettingsTab() method should not have been called, but the plugins lists should be the same
assert mocked_plugin.createSettingsTab.call_count == 0, \
u'The createMediaManagerItem() method should not have been called.'
self.assertEqual(self.mocked_settings_form.plugins, plugin_manager.plugins,
u'The plugins on the settings form should be the same as the plugins in the plugin manager')
def hook_settings_tabs_with_active_plugin_and_no_form_test(self): def hook_settings_tabs_with_active_plugin_and_no_form_test(self):
""" """
Test running the hook_settings_tabs() method with an active plugin and no settings form Test running the hook_settings_tabs() method with an active plugin and no settings form
@ -107,6 +126,11 @@ 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
mocked_plugin.createSettingsTab.assert_called_with(self.mocked_settings_form)
self.assertEqual(self.mocked_settings_form.plugins, plugin_manager.plugins,
u'The plugins on the settings form should be the same as the plugins in the plugin manager')
def hook_import_menu_with_disabled_plugin_test(self): def hook_import_menu_with_disabled_plugin_test(self):
""" """
Test running the hook_import_menu() method with a disabled plugin Test running the hook_import_menu() method with a disabled plugin