← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/bug-1544263 into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-1544263 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-1544263/+merge/285803

Fix the toggle song usage menu item not working

Add this to your merge proposal:
--------------------------------
lp:~raoul-snyman/openlp/bug-1544263 (revision 2618)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1279/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1203/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1142/
[FAILURE] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/978/
Stopping after failure
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-1544263 into lp:openlp.
=== modified file '.bzrignore'
--- .bzrignore	2016-01-09 00:07:15 +0000
+++ .bzrignore	2016-02-11 21:21:05 +0000
@@ -44,3 +44,4 @@
 cover
 *.kdev4
 coverage
+tags

=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py	2016-01-09 16:26:14 +0000
+++ openlp/plugins/songusage/songusageplugin.py	2016-02-11 21:21:05 +0000
@@ -118,7 +118,6 @@
         self.main_window.status_bar.insertPermanentWidget(1, self.song_usage_active_button)
         self.song_usage_active_button.hide()
         # Signals and slots
-        self.song_usage_status.changed.connect(self.toggle_song_usage_state)
         self.song_usage_active_button.toggled.connect(self.toggle_song_usage_state)
         self.song_usage_menu.menuAction().setVisible(False)
 

=== modified file 'tests/functional/openlp_plugins/songusage/test_songusage.py'
--- tests/functional/openlp_plugins/songusage/test_songusage.py	2016-01-08 13:47:52 +0000
+++ tests/functional/openlp_plugins/songusage/test_songusage.py	2016-02-11 21:21:05 +0000
@@ -23,12 +23,23 @@
 This module contains tests for the Songusage plugin.
 """
 from unittest import TestCase
+from unittest.mock import MagicMock, patch
+
+from openlp.core import Registry
+from openlp.plugins.songusage.lib import upgrade
+from openlp.plugins.songusage.lib.db import init_schema
 from openlp.plugins.songusage.songusageplugin import SongUsagePlugin
 
 
 class TestSongUsage(TestCase):
 
-    def test_about_text(self):
+    def setUp(self):
+        Registry.create()
+
+    def about_text_test(self):
+        """
+        Test the about text of the song usage plugin
+        """
         # GIVEN: The SongUsagePlugin
         # WHEN: Retrieving the about text
         # THEN: about() should return a string object
@@ -36,3 +47,22 @@
         # THEN: about() should return a non-empty string
         self.assertNotEquals(len(SongUsagePlugin.about()), 0)
         self.assertNotEquals(len(SongUsagePlugin.about()), 0)
+
+    @patch('openlp.plugins.songusage.songusageplugin.Manager')
+    def song_usage_init_test(self, MockedManager):
+        """
+        Test the initialisation of the SongUsagePlugin class
+        """
+        # GIVEN: A mocked database manager
+        mocked_manager = MagicMock()
+        MockedManager.return_value = mocked_manager
+
+        # WHEN: The SongUsagePlugin class is instantiated
+        song_usage = SongUsagePlugin()
+
+        # THEN: It should be initialised correctly
+        MockedManager.assert_called_with('songusage', init_schema, upgrade_mod=upgrade)
+        self.assertEqual(mocked_manager, song_usage.manager)
+        self.assertFalse(song_usage.song_usage_active)
+
+


Follow ups