Fix invalid log_exception

bzr-revno: 2517
This commit is contained in:
Tim Bentley 2015-02-28 18:59:59 +00:00
commit 5cf4e79489
3 changed files with 25 additions and 2 deletions

View File

@ -39,6 +39,12 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
Constructor Constructor
""" """
super(FileRenameForm, self).__init__(Registry().get('main_window')) super(FileRenameForm, self).__init__(Registry().get('main_window'))
self._setup()
def _setup(self):
"""
Set up the class. This method is mocked out by the tests.
"""
self.setupUi(self) self.setupUi(self)
def exec_(self, copy=False): def exec_(self, copy=False):

View File

@ -358,7 +358,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
shutil.rmtree(os.path.join(self.path, theme).encode(encoding)) shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
except OSError as os_error: except OSError as os_error:
shutil.Error = os_error shutil.Error = os_error
self.log_exception('Error deleting theme %s', theme) self.log_exception('Error deleting theme %s' % theme)
def on_export_theme(self, field=None): def on_export_theme(self, field=None):
""" """

View File

@ -25,7 +25,7 @@ Interface tests to test the themeManager class and related methods.
from unittest import TestCase from unittest import TestCase
from openlp.core.common import Registry, Settings from openlp.core.common import Registry, Settings
from openlp.core.ui import ThemeManager from openlp.core.ui import ThemeManager, ThemeForm, FileRenameForm
from tests.functional import patch, MagicMock from tests.functional import patch, MagicMock
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
@ -105,3 +105,20 @@ class TestThemeManager(TestCase, TestMixin):
new_theme.trigger() new_theme.trigger()
assert mocked_event.call_count == 1, 'The on_add_theme method should have been called once' assert mocked_event.call_count == 1, 'The on_add_theme method should have been called once'
@patch('openlp.core.ui.themeform.ThemeForm._setup')
@patch('openlp.core.ui.filerenameform.FileRenameForm._setup')
def bootstrap_post_test(self, mocked_theme_form, mocked_rename_form):
"""
Test the functions of bootstrap_post_setup are called.
"""
# GIVEN:
self.theme_manager.load_themes = MagicMock()
self.theme_manager.path = MagicMock()
# WHEN:
self.theme_manager.bootstrap_post_set_up()
# THEN:
self.assertEqual(self.theme_manager.path, self.theme_manager.theme_form.path)
self.assertEqual(1, self.theme_manager.load_themes.call_count, "load_themes should have been called once")