Tim Bentley has proposed merging lp:~trb143/openlp/bug-1309886 into lp:openlp.
Requested reviews: Samuel Mehrbrodt (sam92) Raoul Snyman (raoul-snyman) Related bugs: Bug #1309886 in OpenLP: "Exception when clicking "Load new media" button" https://bugs.launchpad.net/openlp/+bug/1309886 For more details, see: https://code.launchpad.net/~trb143/openlp/bug-1309886/+merge/218697 Fix call path Fix PEP8 errors missed by bug in ci command -- https://code.launchpad.net/~trb143/openlp/bug-1309886/+merge/218697 Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/media/lib/mediaitem.py' --- openlp/plugins/media/lib/mediaitem.py 2014-05-01 17:49:43 +0000 +++ openlp/plugins/media/lib/mediaitem.py 2014-05-07 20:38:56 +0000 @@ -229,7 +229,7 @@ self.service_path = os.path.join(AppLocation.get_section_data_path(self.settings_section), 'thumbnails') check_directory_exists(self.service_path) self.load_list(Settings().value(self.settings_section + '/media files')) - self.populate_display_types() + self.rebuild_players() def rebuild_players(self): """ === modified file 'tests/functional/openlp_core_lib/test_image_manager.py' --- tests/functional/openlp_core_lib/test_image_manager.py 2014-04-15 20:30:20 +0000 +++ tests/functional/openlp_core_lib/test_image_manager.py 2014-05-07 20:38:56 +0000 @@ -171,4 +171,4 @@ self.lock.release() # The sleep time is adjusted in the test case. time.sleep(self.sleep_time) - return '' \ No newline at end of file + return '' === modified file 'tests/functional/openlp_core_ui/test_media.py' --- tests/functional/openlp_core_ui/test_media.py 2014-04-20 22:23:26 +0000 +++ tests/functional/openlp_core_ui/test_media.py 2014-05-07 20:38:56 +0000 @@ -125,4 +125,4 @@ # THEN: the used_players should be an empty list, and the overridden player should be an empty string self.assertEqual(['vlc', 'webkit', 'phonon'], used_players, 'Used players should be correct') - self.assertEqual('vlc,webkit,phonon', overridden_player, 'Overridden player should be a string of players') \ No newline at end of file + self.assertEqual('vlc,webkit,phonon', overridden_player, 'Overridden player should be a string of players') === modified file 'tests/functional/openlp_core_ui/test_slidecontroller.py' --- tests/functional/openlp_core_ui/test_slidecontroller.py 2014-01-04 17:19:30 +0000 +++ tests/functional/openlp_core_ui/test_slidecontroller.py 2014-05-07 20:38:56 +0000 @@ -33,7 +33,7 @@ from openlp.core.ui import SlideController -from tests.interfaces import MagicMock, patch +from tests.interfaces import MagicMock class TestSlideController(TestCase): === modified file 'tests/functional/openlp_plugins/remotes/test_router.py' --- tests/functional/openlp_plugins/remotes/test_router.py 2014-04-02 19:35:09 +0000 +++ tests/functional/openlp_plugins/remotes/test_router.py 2014-05-07 20:38:56 +0000 @@ -32,7 +32,7 @@ import os from unittest import TestCase -from openlp.core.common import Settings +from openlp.core.common import Settings, Registry from openlp.plugins.remotes.lib.httpserver import HttpRouter from tests.functional import MagicMock, patch, mock_open from tests.helpers.testmixin import TestMixin @@ -92,15 +92,14 @@ Test the router control functionality """ # GIVEN: A testing set of Routes - router = HttpRouter() mocked_function = MagicMock() test_route = [ (r'^/stage/api/poll$', {'function': mocked_function, 'secure': False}), ] - router.routes = test_route + self.router.routes = test_route # WHEN: called with a poll route - function, args = router.process_http_request('/stage/api/poll', None) + function, args = self.router.process_http_request('/stage/api/poll', None) # THEN: the function should have been called only once self.assertEqual(mocked_function, function['function'], 'The mocked function should match defined value.') @@ -126,6 +125,25 @@ # THEN: all types should match self.assertEqual(content_type, header[1], 'Mismatch of content type') + def main_poll_test(self): + """ + Test the main poll logic + """ + # GIVEN: a defined router with two slides + Registry().register('live_controller', MagicMock) + router = HttpRouter() + router.send_response = MagicMock() + router.send_header = MagicMock() + router.end_headers = MagicMock() + router.live_controller.slide_count = 2 + + # WHEN: main poll called + results = router.main_poll() + + # THEN: the correct response should be returned + self.assertEqual(results.decode('utf-8'), '{"results": {"slide_count": 2}}', + 'The resulting json strings should match') + def serve_file_without_params_test(self): """ Test the serve_file method without params === modified file 'tests/interfaces/openlp_core_common/test_historycombobox.py' --- tests/interfaces/openlp_core_common/test_historycombobox.py 2014-05-01 16:57:45 +0000 +++ tests/interfaces/openlp_core_common/test_historycombobox.py 2014-05-07 20:38:56 +0000 @@ -62,4 +62,4 @@ self.combo.addItem('test2') # THEN: The list of items should contain both strings. - self.assertEqual(self.combo.getItems(), ['test1', 'test2']) \ No newline at end of file + self.assertEqual(self.combo.getItems(), ['test1', 'test2']) === modified file 'tests/interfaces/openlp_core_ui/test_shortcutlistform.py' --- tests/interfaces/openlp_core_ui/test_shortcutlistform.py 2014-04-20 14:13:09 +0000 +++ tests/interfaces/openlp_core_ui/test_shortcutlistform.py 2014-05-07 20:38:56 +0000 @@ -75,4 +75,4 @@ # THEN: The button should be changed. self.assertEqual(button.text(), text, "The text should match.") mocked_check_method.assert_called_once_with(True) - self.assertEqual(button.isEnabled(), enabled, "The button should be disabled.") \ No newline at end of file + self.assertEqual(button.isEnabled(), enabled, "The button should be disabled.")
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp