openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #26374
[Merge] lp:~trb143/openlp/bug-1424297 into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bug-1424297 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #1424297 in OpenLP: "Renaming a theme causes a crash"
https://bugs.launchpad.net/openlp/+bug/1424297
For more details, see:
https://code.launchpad.net/~trb143/openlp/bug-1424297/+merge/251360
Fix code and new test
--------------------------------
lp:~trb143/openlp/bug-1424297 (revision 2516)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/980/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/903/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/846/
[SUCCESS] http://ci.openlp.org/job/Branch-04a-Windows_Functional_Tests/736/
[SUCCESS] http://ci.openlp.org/job/Branch-04b-Windows_Interface_Tests/335/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/472/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/343/
--
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bug-1424297 into lp:openlp.
=== modified file 'openlp/core/ui/filerenameform.py'
--- openlp/core/ui/filerenameform.py 2015-01-18 13:39:21 +0000
+++ openlp/core/ui/filerenameform.py 2015-02-28 09:48:44 +0000
@@ -39,6 +39,12 @@
Constructor
"""
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)
def exec_(self, copy=False):
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2015-02-17 05:51:24 +0000
+++ openlp/core/ui/thememanager.py 2015-02-28 09:48:44 +0000
@@ -358,7 +358,7 @@
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
except OSError as 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):
"""
=== modified file 'tests/interfaces/openlp_core_ui/test_thememanager.py'
--- tests/interfaces/openlp_core_ui/test_thememanager.py 2015-01-18 13:39:21 +0000
+++ tests/interfaces/openlp_core_ui/test_thememanager.py 2015-02-28 09:48:44 +0000
@@ -25,7 +25,7 @@
from unittest import TestCase
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.helpers.testmixin import TestMixin
@@ -105,3 +105,20 @@
new_theme.trigger()
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")
Follow ups