← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/startup_thread_error into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/startup_thread_error into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1296574 in OpenLP: "Missing arguments in some event handler functions"
  https://bugs.launchpad.net/openlp/+bug/1296574

For more details, see:
https://code.launchpad.net/~trb143/openlp/startup_thread_error/+merge/239769

More errors found and test for security
-- 
https://code.launchpad.net/~trb143/openlp/startup_thread_error/+merge/239769
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/startup_thread_error into lp:openlp.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2014-10-21 21:06:02 +0000
+++ openlp/core/ui/slidecontroller.py	2014-10-27 20:35:38 +0000
@@ -1245,7 +1245,7 @@
         if event.timerId() == self.timer_id:
             self.on_slide_selected_next(self.play_slides_loop.isChecked())
 
-    def on_edit_song(self):
+    def on_edit_song(self, field=None):
         """
         From the preview display requires the service Item to be editied
         """
@@ -1254,7 +1254,7 @@
         if new_item:
             self.add_service_item(new_item)
 
-    def on_preview_add_to_service(self):
+    def on_preview_add_to_service(self, field=None):
         """
         From the preview display request the Item to be added to service
         """
@@ -1351,7 +1351,7 @@
         seconds %= 60
         self.audio_time_label.setText(' %02d:%02d ' % (minutes, seconds))
 
-    def on_track_triggered(self):
+    def on_track_triggered(self, field=None):
         """
         Start playing a track
         """

=== modified file 'tests/functional/openlp_plugins/remotes/test_router.py'
--- tests/functional/openlp_plugins/remotes/test_router.py	2014-10-22 20:47:47 +0000
+++ tests/functional/openlp_plugins/remotes/test_router.py	2014-10-27 20:35:38 +0000
@@ -107,6 +107,33 @@
         self.assertEqual(mocked_function, function['function'], 'The mocked function should match defined value.')
         self.assertFalse(function['secure'], 'The mocked function should not require any security.')
 
+    def process_secure_http_request_test(self):
+        """
+        Test the router control functionality
+        """
+        # GIVEN: A testing set of Routes
+        mocked_function = MagicMock()
+        test_route = [
+            (r'^/stage/api/poll$', {'function': mocked_function, 'secure': True}),
+        ]
+        self.router.routes = test_route
+        self.router.settings_section = 'remotes'
+        Settings().setValue('remotes/authentication enabled', True)
+        self.router.path = '/stage/api/poll'
+        self.router.auth = ''
+        self.router.headers = {'Authorization': None}
+        self.router.send_response = MagicMock()
+        self.router.send_header = MagicMock()
+        self.router.end_headers = MagicMock()
+        self.router.wfile = MagicMock()
+
+        # WHEN: called with a poll route
+        self.router.do_post_processor()
+
+        # THEN: the function should have been called only once
+        self.router.send_response.assert_called_once_with(401)
+        self.assertEqual(self.router.send_header.call_count, 2, 'The header should have been called twice.')
+
     def get_content_type_test(self):
         """
         Test the get_content_type logic


Follow ups